Late last year Google introduced a new asynchronous tracking code for their analytics platform. The new code is a much-needed change to their system. The old code on sites was located just before the close-body tag at the end of the HTML. On big sites you would see the page load and then if you watched your browser’s status code you would see the page waiting for Google’s response to the tracking code. The new code is placed just before the close-head tag so it is loaded first and Google responds while the page is being rendered effectively decreasing the overall page-load time since the tracking info is loaded out of sync. Asynchronous means just that, the code can load OUT OF SYNC with it’s position in the HTML so nothing that follows it has to wait for it’s completion. The new code is available through your existing analytics account and I recommend that you replace the old tracking code with the new one.
I have a client that needs to run analytics using two accounts on the same website. There are many reasons for this kind of implementation, but the most common reason is to setup tracking for multiple third-party marketing firms so each can define their own filters, conversion goals, user funnels, etc. Unfortunately, the implementation of the additional account ID on my client’s site was not correct and it “broke” analytics for the other account. One account had good data, the other account couldn’t keep track of the users. This is because the way the code was written, one tracking cookie was being overwritten by the other, and the one associated with the account being overwritten was reading 99% bounce rate, 0.00 time on page, and could not follow users into the site.
Since some of the posts discussing this topic online are a bit technical, I thought I would post an easy-to-understand version here. I’ve placed the correct code below with examples of how you add additional account ids to a website without breaking the analytics.
You can see in the image that I’ve input multiple account ids. (UA-XXXXXXXX-X) Each new id starts with a new letter (b._, c._) and you can continue this for as many analytics accounts that you want to hook up to your site. Remember, the more accounts you connect, the slower the pages will load so I suggest keeping the number of accounts to a minimum.