Reputation: 415
I have just inherited a site that had two different GA codes on the same pages that are tracking from top level down to sub domains. I have now removed the “two” GA codes and amalgamated the two different ID’s in to a single code using the suggested method below.
gaq.push(
['_setAccount', 'UA-XXXXX-1'],
['_trackPageview'],
['b._setAccount', 'UA-XXXXX-2'],
['b._trackPageview']
This seems to be working fine however the figures, in particular the bounce rate has dramatically changed for the worse since implementing the new code snippet.
I have found loads of tutorials explaining you shouldn’t have two GA codes on one page and you should use the _set Account method but I can’t find any explanation as to why you shouldn’t.
I want to go back to the client and explain why the figures have changed so dramatically since the implementation of the new GA snippet but can’t find a valid explanation. I initially presumed the second GA code may have been over writing the previous cookies, or possibly an issue with the Asynchronous tag pushing out the data with two tags there.
Any ideas why two tags don’t work properly on the same page??
Upvotes: 2
Views: 5219
Reputation: 10557
You likely lost all the data tied to the subdomains. I'm going to guess the site before you modified it had the old google tracking code or maybe even the old urchin code?
In any case you need to use _setDomainName('example.com') if your tracking multiple domains as explained at https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite#yourDomainName
Another helpfull guide is at http://support.google.com/googleanalytics/bin/answer.py?hl=en&answer=55570
Two tags like you're doing should work fine and here's a use case for doing that. It's not recommended or a supported implementation that you use two seperate tracking javascript (.js) loads.
gaq.push(
['_setAccount', 'UA-XXXXX-1'],
['_trackPageview'],
['_setDomainName', 'example.com'],
['b._setAccount', 'UA-XXXXX-2'],
['b._trackPageview'],
['b._setDomainName', 'example.com']
Upvotes: 5