Mailbag on Monday because Angie Meeker asks:
Do you have an article about getting Google Analytics right on Multisite, so SA can see indiv stats for each site, but also parent. Where the SAdmin owns the entire GA account (site owners don’t need their own GA account)
There are a few ways to do this, and they’re all pretty easy.
Google Mod_PageSpeed
This is the ‘easiest’ way if you already have PageSpeed installed. You can put in your GA filter in the .htaccess and be done with it:
ModPagespeedEnableFilters insert_ga ModPagespeedAnalyticsID <Analytics ID>
That’s actually what I do here, because I’m incredibly lazy and I have Pagespeed set up on my server. I can even make this a little more special by using if statements in Apache 2.4:
<If "$req{Host} == 'www.domain.com'"> ModPagespeedEnableFilters insert_ga ModPagespeedAnalyticsID <Analytics ID> </If>
MU Plugin
But if you’re still on Apache 2.2 or don’t want to mess with .htaccess for whatever reason, then you should try an mu-plugin, my favorite things in the world. And all you have to do is this:
// Paste your Google Analytics code here