Getting Accurate: Google Analytics 'Async' Tracking

IMPORTANT:

This is a historical post from 20 May 2010.

Google Analytics has now released the new Google Analytics asynchronous (or 'async') tracking code which provides improved tracking accuracy without impacting the loading speed of our web pages.

What improvement can I expect?

We have seen a 4% improvement in number of visitors being tracked when comparing the new async tracking code to the previous tracking code.

We have also seen a dramatic improvement in AdWords accuracty by having the tracking code at the top of pages; close to 100% accuracy.

running-shoes

running-shoes

What do I need to do?

You do not need to change to the new tracking code straight away, your existing tracking code will continue to work.

If you have a standard Google Analytics implementation (and have not modified the tracking code) you can simply replace your existing code with the new code on all the pages of your site.

If you have modified the tracking code (e.g. for ecommerce, events, file downloads, outbound links, multi-domain, sub-domain, custom variables, etc.) then you will need to update the async code to continue tracking those elements.

async

async

Okay, where can I get the new tracking code?

  1. Login to Google Analytics
  2. Click 'edit' for the particular profile
  3. Click 'check status' on the top right (above profile information)

Where do I install the new tracking code?

Place the new tracking code just before the closing tag (and ensure you remove the previous tracking code).

UPDATE: The Google Analytics team previously recommended that the tracking code be placed after the opening due to an Internet Explorer issue, but it is now safe to use the code just before the closing  tag.

How do I know what tracking code I am currently using?

To check what tracking code you are currently using, browse to your website and view the source code of one of your pages. Then search for 'trackPageview' in the source code.

If you see something along the following lines you are using the previous tracking code;

pageTracker._trackPageview();

If you see something that includes 'gaq.push' you are already using the new asynchronous tracking code;

_gaq.push(['_trackPageview']);