Sometimes Two Is Better Than One
Google Analytics accounts access and linking with AdWords can become surprisingly messy. Some common problems into which we’ve run over the years are:
- We or the client can’t have account access to either AdWords or Analytics
- A pre-existing AdWords account couldn’t be unlinked from Analytics
- Multiple AdWords accounts need to drive campaigns to the same site
- Analytics accounts were set up incorrectly, and granting access to ‘one’ account would share ‘all’ accounts with us.
In other words, we find that we need to use two Analytics accounts for the same website when:
- AdWords / Analytics experience ‘account access issues’ (e.g. someone lost a password, changed agency, etc)
- We need to run multiple AdWords campaigns (e.g. multi-country websites, departments with different billing details, etc)
These two reasons are most definitely not the only, and each webmaster should evaluate his or her specific situation accordingly.
With that being said, here’s how to track two Analytics accounts on one website:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-#####-#"); // FIRST CODE
pageTracker._trackPageview();
var secondTracker = _gat._getTracker("UA-#####-#"); // SECOND CODE
secondTracker._trackPageview();
} catch(err){}
</script>
If you don’t like reading code, here’s the simple version: you need only replace the ‘UA-#####-#’ with your own analytics account numbers. As an organizational tip for webmasters, we recommend labeling each of the two analytics codes. In the above code, you’ll notice commented out lines, like ”// FIRST CODE. The idea here is to replace the commented out text with a useful name to identify the account. This helps keep organised in cases where multiple AdWords and Analytics accounts need to be linked.
Have questions or have any other cool Analytics tricks? Let us know in a comment!