Over a million developers have joined DZone.

Optimizing Google Analytics Site Speed

· Performance Zone

Download Forrester’s “Vendor Landscape, Application Performance Management” report that examines the evolving role of APM as a key driver of customer satisfaction and business success, brought to you in partnership with BMC.

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]);
_gaq.push(['_trackPageview']);

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.

See Forrester’s Report, “Vendor Landscape, Application Performance Management” to identify the right vendor to help IT deliver better service at a lower cost, brought to you in partnership with BMC.

Topics:

Published at DZone with permission of David Shaw, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

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

{{ parent.tldr }}

{{ parent.urlSource.name }}