Tag Archives: google analytics site speed

Analytics now Tracking Site Speed

On Wenesday Google announces on their Analytics Blog that you can now view a report of your sites’ speed.

This could become one of the most useful reports for optimisation especially since Google announced they are now considering site speed a ranking factor. However the results received must be taken with a pinch of salt, as only a small sample of page views are used to create an average which is displayed in the report.

As long as outliers or any type of extreme page views (eg. dial up internet) aren’t chosen for the report the results will be extremely informative and useful.

The report is only available in the new version of analytics, probably to create more incentive for users to convert.

To use this new feature you need to add the bold text into the currently existing Google Analytics tracking code;

For Asynchronous Code (This is usually the default) :

<script type="text/javascript">
 var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-XXXXX-X']);
 _gaq.push(['_trackPageview']);
 _gaq.push(['_trackPageLoadTime']);

 (function() {
   var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
   ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') +
'.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

For Traditional Snippet:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js'
type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
pageTracker._trackPageLoadTime();
} catch(err) {}
</script>

If installed correctly site speed data should start showing up a few hours after the new code is uploaded.

More information about Installing the Site Speed Report.