Update your Google Analytics tags for site speed

Reading Time: < 1 minute

Google Analytics (GA) now has a new feature – Site Speed data. That help page mentions that your GA tag needs one more line (in red) as follows:

<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>

I use the Thesis framework, so I didn’t have to edit the theme php files. There is a handy input window in the Thesis Site Options. It’s as simple as that, but how do you see the data?

Changing Google Analytics tags in Thesis
Changing Google Analytics tags in Thesis

Go to Google Analytics and if you’re like me, you won’t see it. It is supposed to show up in the Content area, but only if you have switched to the new GA interface (look for a link next to your email address at the top right.)

You should be using a caching plugin such as WP Super Cache my preference) and should flush the cache. A few hours later you will have a few visits so there will be page load time data to look at.

This is another way for Google to remind us that the page load time needs to be as small as possible. If you need to convince someone with a report from Stanford University, point them at Kohavi and Longbotham’s (PDF)  Online Experiments: Lessons Learned. The specific quote is:

Experiments at Amazon.com showed that every 100-ms increase in the page load time decreased sales by 1 percent, while similar work at Google revealed that a 500-ms increase in the search results display time reduced revenue by 20 percent.

 

Mastodon