How to setup new Google Analytics SiteSpeed feature to measure page load time
|
Update: This article is now deprecated, here is the official explanation:
As you might know, the G firm evangelizes a lot about making the web faster for several years. They started several projects in order to measure your website efficiency and this is the last one. It allows to measure average load page time inside the new Google Analytics, in beta. In fact, it’s important to marketing because slow pages implies a number of emarketing side effects. Here are the steps needed to turn it on: 1. Inside Analytics, select “New version” to open the new beta
2. By default, SiteSpeed is turned off, so you need to change your tracking code (inside your page’s code) by adding one line (as explained in GA’s help) <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>
3. After a day or so, GA will start collecting measures and will produce metrics like below under Content > Site Speed
Related posts:
|



Update: This “trackPageLoadTime” function is now deprecated. So even if it still works, Analytics now automatically tracks page load time (at a lesser sampling rate: 1% instead of 10% pageviews). In addition, I recommend to erase this line, as it seems to generate problems with some CDN.