Digital Marketing • SEO • PPC • CRO

Don’t trust Google Analytics Site Speed! (Fix Included)

I have learnt recently that you should not trust the Google Analytics Site Speed feature, until you have fixed it! I see you scratching your head wondering why you shouldn't use such a feature that Google have added. There is a simple answer, it is only a 1% sample of website visitors, this does not give a true reflection of what is really going on. Unless of course you have millions of visitors, but even then you'd much rather have 100% right?

There is a super quick fix of how you can get 100% of the site speed data, well what visitors google can actually use as they cannot determine it for all visitors. See below a quote from Google's Help Files:

Site speed can only be tracked from browsers that support the HTML5 Navigation Timing interface or have the Google Toolbar installed. Typically this includes: Chrome, Firefox 7 and above, Internet Explorer 9 and above, Android 4.0 browser and above, as well as earlier versions of Internet Explorer with the Google Toolbar installed.

I would have expected Google to highlight this on the Site Speed tab, as they usually do with other reports specifying it is only 1% sample of data. You only need one visitor with a slow connection and it will push the average up, which is what I was seeing. There would be random spikes throughout the day which didn't make any sense. Anyway lets get on to the actual fix!

The SiteSpeedSampleRate Fix

The value that you need to set is for the variable SiteSpeedSampleRate and the value needs to be 100 if you want to get 100% of the data. I have tried researching to see if there is any negative impact from setting this to 100%, but i can't find anything.

Universal Analytics (analytics.js library)

If you're using UA its easy, just amend the ga('create', 'UA-XXXX-Y'); as follows:

ga('create', 'UA-XXXX-Y', {'siteSpeedSampleRate': 100});

Analytics (ga.js async library)

If you're using the older ga.js its a little tricker, but not too difficult. You will need to add the following line after you’ve initiated the tracker and before calling _trackPageview. See below:

_gaq.push(['_setSiteSpeedSampleRate', 100]);

That is it! Enjoy your new set of data that you can now rely on! I have found there are no more spikes and the data is much more consistent.

Comments are closed.