Tracking Multiple Domains Individually and as a Group in Google Analytics

Website managers who track multiple top-level domains individually but also want to track some or all of them as a group in one profile can do so with the proper tracking code installed.

Say you have multiple sites that you manage: site1.com, site2.com, and site3.com.

You want each to have their own analytics profile that the site owner’s can access. You also want to dump all three sites into a single profile as an aggregate. Useful for saying things like, “I manage three site that get X amount of traffic.” Or, for seeing the totals on web stats that all sites impact. For example, sports-car-shirts.com and ferrari-shirts.com. How many ferrari shirts were sold on both sites? Easy to determine if they dump into the same profile.

Create the Accounts

Google Analytics (GA) consists of Accounts which contain one or more Profiles.

Accounts have an alphanumeric account ID associated with them in the form of UA-1233456-1. This is placed in the tracking code as _gaq.push(['_setAccount', 'UA-1234567-1']);

Profiles have a numeric profile ID that is sometimes referred to as the table ID. It can be found by going to Admin (upper left) and clicking on Profile Settings under the profile name. It will be listed as Profile ID. The Profile ID is not needed to set up the tracking.

Account ID (tracking code _setAccount): UA-1234567-1
Profile ID (also known as table ID): 12345678

One Account can have multiple Profiles with distinct Profile IDs.

GA docs illustrate this as:

When you create a new GA Account, always, always, always create 2 profiles. That goes for every Account you set up. Create a base or “raw” profile and don’t ever touch it again. Look but don’t touch. Create a second “default” profile that you apply filters to and perform all other sorts of magic. If the “default” profile ever gets messed up by a filter or other unintended consequences, you still have all your data in the “raw” profile.

Profiles are the “buckets” that data gets dumped into. They can contain all the data or a portion based on filters.

Tracking

Using the example of three (3) separate sites, we will have four (4) separate accounts each with two (2) profiles in them (raw and default). One Account for each of the sites and one for the aggregate. Sounds like a lot but don’t worry; this is easy and quick.

The site owners will get access to the “default” profile of the account respective to their website.

For each of the three sites, add the tracking code with multiple trackers. One will track the site individually, one will dump into the aggregate account.

var _gaq = _gaq || [];
_gaq.push(
['_setAccount', 'UA-XXXXX-1'],
['_trackPageview'],
['aggregate._setAccount', 'UA-XXXXX-2'],
['aggregate._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);
})();

The multiple tracker puts the data in the site’s profile first and then puts the data into the aggregate account.

Place this code on all three accounts swapping out the site’s account number as appropriate.

Once it is all set up, put a filter on the “default” profile of the aggregate account to display the domain name in the reports. Leave the “raw” profile of all the accounts alone. This will help you distinguish pages with the same name in the reports. For example, site1.com/contact.html and site2.com/contact.html. See Modify your cross-domain profile with a filter to show the full domain in your content reports.

Check that data is being tracked by checking the “Tracking Status” in the Account Admin (Admin -> Tracking Code).

Check the data received in each account and profile the next day to make sure the appropriate data is being dumped where it should be and that you hostname filter in the aggregate profile is working properly.

Posted in Google Analytics. Tags: . Permalink. Both comments and trackbacks are closed.