Over a million developers have joined DZone.

Optimizing Google Analytics Site Speed

DZone 's Guide to

Optimizing Google Analytics Site Speed

· Performance Zone ·
Free Resource

Improving the load time of your website has been proven many times to be an effective method for improving your websites conversion rate.

speedoI’ve been helping several websites with their site speed optimisation over the past couple of weeks which has highlighted a trend that appears to be affecting many Google Analytics accounts.

This trend is a lack of ‘Site Speed’ data in Google Analytics. In order to make informed decisions you have to have adequate data, if you only have 10 page load samples for a given page then chances are some of those samples do not represent an  accurate picture of the average load time for the page.

By default Google Analytics only collects data on 1% of page loads for their ‘Site Speed’ report and not all visits qualify for tracking depending on the capabilities of the web browser. This means that websites with lower traffic levels will undoubtedly have inadequate data to perform effective site speed analysis.

Luckily Google Analytics provides you with the ability to increase the number of samples that get recorded, all that is required is a small addition to your Google Analytics javascript.

We need to add a call to the _setSiteSpeedSampleRate() function asking Analytics to increase our sample rates. This call needs to be added above the track pageview request, like so:

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

The above code will increase the sample size percentage from 1% to 10%. I would recommend 10% as a minimum to collect. It is believed that Google will limit samples to 10k per month.

Please go and make this change now so that you get enough site speed data to make informed decisions and don’t rely too heavily on unbalanced data.


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}