After all your page speed optimizations are done, how do you know if they’re having an actual impact on the loading speed? No matter how many speed tests you conduct with the pagespeed tool by Google or on webpagetest.org, there’s no substitute for real-world monitoring. With testing tools, you at best get a simulacrum of real-world conditions. You can’t account for device, operating systems, slow Internet speeds, and a host of other factors.
The only way to test the results of your efforts is to get the full-page speed details of each and every page load. There are tools that do this. Unfortunately, it requires you to include a Javascript tag on each and every page. This is unavoidable, so the best we can hope for is for an existing tag to do the job for us.
Luckily, we already have a such a tool – trusty Google Analytics. But we need to configure it first.
Google Analytics Tracks Page Speed Metrics
In addition to all the wonderful things Google Analytics does, it also tracks your page speed. In your reports section, click the label on the right called “Behavior”, and you’ll see a “Site Speed” section as shown here:
From here, you can monitor various metrics like DNS redirection time, server connection time, server response time, and final page load time. Particularly useful for me, is the “hourly” report in the “Overview” section for a single day as it allows me to get more fine-grained results without all the aggregation.
But the Problem with Site Sampling
There’s a snag though. By default, Google Analytics doesn’t report every page view time. In fact, it samples only 1% of the total pageviews! That means unless your site gets thousands of pageviews every day, you’ll hardly get a decent sample size to get a representative idea of how fast your site’s speed metrics are.
This is what my speed analytics data used to look like before:
Google allows up to 10,000 site speed samples to be sent every day. The only way you’re going to hit that limit is with 1 million daily pageviews 🙂
Luckily, we can configure Google to increase the percentage of pageviews it sends for speed sampling – and dial it all the way up to 100% if necessary. Here’s how to do it.
Changing the Site Speed Sample in Google Tag Manager
This is the preferred method of changing the site speed sample rate. Google tag manager is how you should be using Google Analytics in any case. Once set up, it’s far easier to manage your tracking code, which also gets updated to the newest versions whenever necessary. It’s a great way to add all kinds of cool functionality to your site. Check it out!
If you’ve set up Universal Analytics in Google Tag Manager, you need to go into your tag settings and click the checkbox saying “Enable overriding settings in this tag” as shown here:
This opens up a bunch of options below and allows you to set individual parameters for Universal Analytics. Under “More Settings”, set the following:
- Field Name – siteSpeedSampleRate
- Field Value – 100
You can see how it’s done in the screenshot above. Save your changes, and publish the Google Tags to your site after adding a comment how what you changed, just in case you want to keep track later.
Testing the Page Speed Data
Now when you visit Google Analytics, you should see much better data in the Site Speed report since 100% of all visits are being reported. Like this:
It’s far more accurate and you can break down the data by country, browser, and telecom provider to get an idea of the factors that most impact your site speed.
If you’re at all interested in maximizing your page speed, then setting up Google Analytics to report all the visits is the first step to measuring it properly!
I’m a NameHero team member, and an expert on WordPress and web hosting. I’ve been in this industry since 2008. I’ve also developed apps on Android and have written extensive tutorials on managing Linux servers. You can contact me on my website WP-Tweaks.com!
Gus says
Hi! Very useful. I started working on optimizing a website which has this set to 10. Who would do that? Why? Do this have any impacto on site performance?