How to Track Multiple Sites with Google Analytics

As the publisher of more than fifty sites, I have more than a hundred profiles in my Google Analytics accounts. Spotting trends across this many individual reports is rather difficult without an aggregate view. After thinking about it, I figured I had four options. I’m sure there are more ways to do this, but here’s what I came up with.

In order to view an aggregate report across multiple Google Analytics profiles, I could either:

  1. manually export each profile to a spreadsheet
  2. or learn to use the Google Analytics API (or more sensibly hire someone to use the Google Analytics API)
  3. or buy a script such as GA Data Grabber (which is a fine script, but all that downloading/creating/graphing still takes desktop time)
  4. or create an aggregate Google Analytics profile, and let Google do all the heavy lifting

I opted for option 4 (create an aggregate GA profile) because after the initial bother of touching each of my sites to modify the onsite Google Analytics code, it pretty much gave me EXACTLY what I needed: an efficient way of looking for big picture trends across all my sites! This approach involves calling TWO Google Analytics profiles from each site. One dedicated to that domain, and the second being the Aggregate profile.

Here’s how I did it.

1) First I created a profile called “Aggregate” in Google Analytics. Unfortunately you need to specify a domain URL to do this. So pick one, let’s say “example.com”.

2) Then create another profile for example.com where you will FILTER out the aggregate traffic. Now you will have three profiles for domain example.com: Aggregate, Unfiltered, Filtered. For reporting purposes, you can ignore the Unfiltered profile. In Filtered, you need to add the following filter, which will ignore all the other domains which are being tracked, and only give you reports for “www.example.com”:

3) In the Aggregate profile, you need to add full URLs to the reports (such as “www.example.com/about-me/” ) because otherwise you will only see URIs which look like this: “/category/widgets/” or “aboutme.php” and you won’t know which site they belong to! Here is the filter you need to add to the Aggregate profile:

4) Now you need to add the Aggregate profile to the Google Analytics tracking code on each site you want included in the Aggregate profile. If you are using the standard asynchronous GA code for profile UA-111111-22, it will look like this before you add the aggregate profile to it:

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-111111-22']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

Assuming your Aggregate profile is UA-333333-44, you will replace the two _gaq.push lines from the default code above, so your GA code now looks like this:

<script type="text/javascript">

  var _gaq = _gaq || [];
 _gaq.push(
  ['_setAccount', 'UA-111111-22'],
  ['_trackPageview'],
  ['b._setAccount', 'UA-333333-44'],
  ['b._trackPageview']
);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

Now, rinse and repeat, modifying the GA code on each site you want included in your Aggregate profile. Have a good night’s sleep, and tomorrow you can check your Aggregate profile stats!

Let me know if this was helpful to you, by leaving a comment below.

Comments

  1. Kieffer says

    Hi Barbara,

    This is great info! However, I read somewhere that if you use the same google analytics code on multiple sites then it’s easy for others to somehow do some special search query which will tell then give them a list of all your websites? Do you know if this is true? I want to build multiple sites but I don’t want others to figure out they’re necessarily mine.

    I have another question. Since you manage many sites do you know if there is some kind of software that helps one keep track of where you host them, passwords, progress on each site, strategies you’re using on each site, tasks you have to do for each site, rank checking them (built-in)? I hope that makes sense.

    Kind regards,

    Kieffer