Tagging for Multiple Google Analytics Profiles

It appears to be a fairly common practice to tag a web site to send data to multiple Google Analytics profiles. However, if done incorrectly, it could result in significant errors in your data, and significantly impact analysis on the whole.

This was recently the case with a client of mine (who shall remain anonymous). They tried to implement the new “analytics.js” tracking (over the older “ga.js”) on a redesigned site they did for a client of theirs. They also wanted to send data to three different Google Analytics profiles, as requested by their client.

Here is the code they used:

 ga('create', 'UA-421xxxxx-x', 'domain.com'); ga('send', 'pageview');
 ga('create', 'UA-329xxxxx-xx', 'domain.com'); ga('send', 'pageview');
 ga('create', 'UA-286xxxxx-x', 'domain.com'); ga('send', 'pageview');

The problem with this code is primarily, it’s sending all three pageview calls to the first Google Analytics profile, UA-421xxxxx-x. So some of the traffic data on that profile was now corrupted. The pageviews were tripled, the bounce rate, time on site, and any path reports (like Visitors Flow) were completely inaccurate.

Don’t let this happen to you – if you are going to use the new “analytics.js” tagging method and you wish to send data to multiple profiles, here is the correct way to write your code:

 ga('create', 'UA-421xxxxx-x', 'domain.com');
 ga('create', 'UA-329xxxxx-xx', 'domain.com', {'name': 'b'});
 ga('create', 'UA-286xxxxx-x', 'domain.com', {'name': 'c'});
 ga('send', 'pageview');
 ga('b.send', 'pageview');
 ga('c.send', 'pageview');

For more details on this tagging solution, please refer to the Google Analytics Developers Guide.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s