Beantin webbkommunikation

Beantin Beta Blog

Experiments, investigations, and tests of web things
March 11, 2013

Increase the amount of site speed data in Google Analytics

Out of the box, Google Analytics only records the navigation timing information for about 1% of page views.

Unless you’ve got a relatively big and busy site that generates over 10,000 “hits” to Google Analytics per day, then you will want to increase that sample rate and record as much page load speed information as possible into GA.

Add: “_gaq.push([‘_setSiteSpeedSampleRate’, 100]);” directly before the ‘_trackpageview’ line in your Google Analytics code snippet. This tells GA to atempt to record the navigation timing information for 100% of pageviews.

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

I say “attempt” as if you have passed the 10,000 “hits” limit that day, then it won’t be recorded. Google will automatically lower the sample rate down (to a minimum of 1%)

Google themselves encourage you to set the sample rate to 1% if you have over “a million hits a day”. I haven’t experimented to see what the affect not doing this has, but it probably doesn’t make any noticable difference if you leave it at 100% no matter how busy your site is.

If you’re feeling kind, then you could nudge the sampling percentage down – work it out yourself. If you have 20,000 pageviews a day (and each pageview only generates one “hit” – you may have events causing other kinds of “hits”) then you could set the sample rate to 50%.

Those of you with a WordPress site and using Yoast’s Google Analytics for WordPress plugin will need to paste _gaq.push([‘_setSiteSpeedSampleRate’, 100]); into the “Custom code” box in the settings.

The Site Speed reports give you access to precise page loading information for specific pages. This is wonderfully useful information to help optimise your site and its content.

Related Posts Plugin for WordPress, Blogger...
Theme Beantin created by James Royal-Lawson. Privacy Policy