How to Add Google’s New Site Speed Tracking to Your WordPress Site

Google recently announced their new Site Speed tracking feature for Google Analytics which allows you to measure the page load times across your site.

Uses for the Site Speed Report

  • Content: Which landing pages are slowest?
  • Traffic sources: Which campaigns correspond to faster page loads overall?
  • Visitor: How does page load time vary across geographies?
  • Technology: Does your site load faster or slower for different browsers?

If you want to take advantage of the new Site Speed tracking, you’ll need to update the tracking code that you already have on your WordPress site. It’s very easy and you can do it just a couple steps.

Step 1: Add the Site Speed code to your Asynchronous Google Analytics tracking code.

This step is easier than it sounds. More than likely your tracking code is in your footer.php file. Your theme may even have an options page where you paste the code in.

If you’re using a plugin to add the tracking code for Google Analytics, you’ll want to check to see if it’s already been updated with the new tracking code before trying to add it yourself. For example, our plugin Google Analytics for WordPress Multisite supports Site Speed tracking already, so there’s no need to add it in. It’s also single-user and BuddyPress compatible.

Once you’ve located the tracking code on your WordPress site, all you have to do is paste in one line to add Site Speed tracking:

1
_gaq.push(['_trackPageLoadTime']);

So now your Asynchronous code snippet should look something like this:

1
2
3
4
5
6
7
8
9
10
11
12
<script type="text/javascript">// <![CDATA[
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>

Step 2: Check to see that Site Speed reporting in working your Google Analytics account.

Log in to your Google Analytics account and make sure you’ve clicked on “New Version” at the top. Then go to My Site >> Reports >> Content and click on Site Speed.

By default, Site Speed tracking is disabled until you add the code to your site. It may even take a few hours for it to start pulling in any numbers, so don’t worry if it’s not working right away.

The page load information that this new tracking code provides can be very important for finding slow pages of your site where you may be losing sales or not connecting with your visitors. I would recommend updating all of your WordPress sites as soon as possible so that you can start getting this valuable information.

For more information, refer to the Site Speed section in the Google Analytics Help Center.

Comments (8)

Participate