Measuring User Load Time: New Google Analytics Feature

Measuring User Load Time: New Google Analytics Feature

You may have noticed that the Google Analytics team have been very busy over the past few weeks, pushing out updates to all accounts. The latest addition is to the Site Speed area, where you can see a collection of page loading times on a per user basis  rather than en masse.

So how is this different from before? Well, the old way that data was collected was via a random sampling of 10% of your site’s visitors. As in, Analytics would measure the page loading time of 1 in 10 visitors to your site for each page. So essentially, what could happen was that visitor A who is on a shared 56k modem connection was timed for your homepage, and a uni student on their University’s 100mb+ connection was measured for Page B.

This obviously creates a bit of an imbalance in terms of the data that is reported, but this new update seems to be about picking one user and timing all their visits until they leave the site. If this is what it seems to be, then it represents a massive step forward in terms of getting consistent accurate data throughout Analytics.

Unfortunately, Google’s current documentation on how to implement this tracking is sorely lacking on its help page, which can be viewed here(EDIT: The implementation documentation has since been added.)

So I’ll show you here how to build your own. The following example tracks how long it takes our Jquery Library to load from our Google CDN.

_gaq.push([‘_trackTiming’ < – This tells Analytics to add a time to our reports.

,’jQuery’, < – This tells Analytics we want to call this time Jquery.

,’Load Library’, < – Here we can give a more specific label , which I’m choosing to call this the ‘Load Library’.

,20, < – The time you’re adding to the reports (Note: you have to calculate this yourself).

,’Google CDN’, < – Optional: Lets you segment and label even further (so we know this particular one is from the Google CDN)

,50]); < – Optional: The sample rate. Here I’ve chosen 50% of visitors to be timed.

When you put all this together you get something that looks like this.

_gaq.push([‘_trackTiming’, ‘jQuery’, ‘Load Library’, 20, ‘Google CDN’, 50]);

And you’ll be collecting time (and improving your conversions) in no time! Any questions? Drop them in the comments below.

  • Posted at 8:31 am, May 11, 2012
  • dzul
    Posted at 6:49 pm, June 8, 2012

    Where to put that code?

    • Posted at 3:50 pm, June 19, 2012

      Hi dzul

      I’d place this code just before “_gaq.push([‘_trackPageview’]);”.

      Let me know if you need any help!


  • ashutosh
    Posted at 4:14 am, September 5, 2012

    i need help regarding user timings. i am not getting any data. this is my code…

    var _gaq = _gaq || [];
    _gaq.push([‘_setAccount’, ‘removed-xxx-x’]);
    _gaq.push([‘_trackTiming’, ‘Test’, ‘callback_timeout’, 20, ‘animation’,100]);

    (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);

    is something wrong ???

    • Posted at 10:00 am, September 11, 2012

      Hi Ashutosh

      From looking at your code it looks correct and should function. I tested your analytics code (Copy and Pasted) on our own site and it appears to be sending the correct information to Analytics.

      If you like I can take a look at the URL where you’re experiencing problems as there may be other Javascript that may be interfering.

Post a Comment