Google Analytics Launches Asynchronous Tracking to Mixed Reviews

With Google's perceived focus of wanting to speed up the web, it should be no surprise that they recently released their new asynchronous tracking code for Google Analytics. It is important for webmasters looking to add this code to their website that it is still in the Beta phase, as their designers are quick to point out. However, it is off to a great start offering important advantages to speeding up websites load time as well as gathering more consistent traffic data.

Why Use Google Analytics Asynchronous Tracking?

Faster Load Time

The biggest problem with loading JavaScript is that it blocks the webpage from rendering as well as preventing resources from being downloaded. One way to prevent this from happening is to use a Script DOM Element approach. Google Analytics asynchronous tracking was designed using this very approach. This approach allows the script to load without getting in the way of images and stylesheets. This should allow for the webpage to load much faster, which makes users happy and more likely to stay on your site longer.

Increased Overall Uptime

If a script takes to long to load or fails to load altogether, users get stuck looking at a blank page instead of your website. Google Analytics asynchronous tracking allows your website to load even if the script fails, this means increased uptimes and not having your website not load because of a third party script.

Get More Data, More Consistently

The old Google Analytics code was placed at the bottom of the webpage, often in the footer. This means that if a user came and then left the page before the footer was loaded, you would not ever know that they were there. With the new Google Analytics asynchronous tracking is placed in the header, which means that you will know whenever your page is loaded.

Still in Beta

It is important to keep in mind that Google Analytics asynchronous tracking is still in BETA. This means that there are still some kinks that need to be worked out. So far, some drawbacks that need to be fixed include:

  • No Benchmark Data Collected Yet
  • Has Failure Reports When Using IE 6 & IE 8
  • Uses a Channel Which Can Mean Blocking Other Resources From Loading
Subscribe to WebmasterFormat RSS Feed Follow WebmasterFormat on Twitter
tom fiji:

Asynchronous tracking across subdomains

I tried use this to track accross my subdomains, but I wasn't able to set it properly. Any advice? how to translate pageTracker._setDomainName(".example.com");
into new code?

red5 (not verified):

Code setup wizard

there is great new feature that enables you to add additional data into to code when creating new profile:
http://analytics.blogspot.com/2009/12/holiday-bonus-more-great-features....

Brian (not verified):

no confirmed errors in IE

I still haven't seen any cases where the new snippet was confirmed as the source of any problems in IE. If you know of an isolated failure, please share.

Brian (not verified):

channels are not an issue

Browser download "channels" are per domain. The async snippet won't block anything not on the google-analytics.com domain.

Brian (not verified):

confirmed the IE problem... (fixed examples)

I've now confirmed the IE problem. It happens in pages that have unclosed tags in the above the GA code. For example:

<head>
   <base href="...">
   <!-- GA code -->
</head>

Would break. Whereas the following would not:

<head>
   <base href="..."></base>
   <!-- GA code -->
</head>

Another solution to the problem is to put the GA code at the top of the instead of the bottom of the . That will ensure you page doesn't trigger this parsing bug in IE.

Brian (not verified):

@fiji - Before:

@fiji -

Before: pageTracker._setDomainName(".example.com");
After: _gaq.push(['_setDomainName', '.example.com']);

johannV (not verified):

setup wizard is only for ga.js

@red5 - setup wizard is only for the standard ga.js code.

@Brian - thanks for your explanations, I was also wondering how to set up domain+subdomain tracking with async GA code.

Anonymous (not verified):

I would like to try new

I would like to try new asynchronous code. Can someone tell me how to track clicks on outbound links with the new code? Currently I'm tracking them with the onclick attribute added to links:

onClick="javascript: pageTracker._trackPageview('/outgoing/example.com');

Should that be changed if the new code is used?

Anonymous (not verified):

outbound links with asynchronous code

try replacing this part:

onClick="javascript: pageTracker._trackPageview('/outgoing/example.com');"

with this one:

onclick="javascript: _gaq.push(['_trackPageview', '/outgoing/example.com']);"

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h2> <h3> <blockquote> <b> <center>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.