We have been focusing a lot on performance recently and trying to find a common metric that we can use across applications to measure our website performance. We have had Google Analytics setup on the sites for a while and use it from time to time. In this case, we started diving deeper in the site speed analytics which had some numbers but they didn’t seem to match the slowness our users were seeing.
Here is a screenshot of a site speed report for the last month for a site which doesn’t look too bad. Notice however a few days where the site speed is 0 (zero).
When we segmented the traffic by country its even worse, most days in fact have a speed of zero.
This was confusing for a while but finally found the help notes next to the metric selector.
Avg. Page Load Time is the average amount of time (in seconds) … If you see zero (0) as a value or a small increase in November 2011, read the About Site Speed article.
The About Site Speed page said the default sample size is 1% for site speed. And they suggest to bump up the sample size if you see zeros for site speed and/or you have traffic lower than 100,000 per day.
By default, a fixed 1% sampling of your site visitors make up the data pool from which the Site Speed metrics are derived. If you have a relatively small number of daily visitors to your site, such as 100,000 or fewer, you might want to adjust the sampling to a larger rate. This will provide increased granularity for page load time and other Site Speed metrics. (See Site Speed in the Help Center for details about the Site Speed reports.)
The Root Problem
We don’t get enough traffic on this site for the sample size to be significant. If you get close to 100 hits per day for any given segment, you probably won’t get a site speed sample for that segment on that day, thus a zero. The two days in the first graph that have zero for the “All Users” segment is on the weekend when the site gets far less traffic (70 and 120 views on Sat. and Sun. in that case) and thus we didn’t get any site speed samples
The Fix
The fix is pretty easy, just specify the desired site speed sample rate in your Google Analytics code:
ga(‘create’, ‘UA-XXXX-Y’, {‘siteSpeedSampleRate’: 10});
Hope this helps others. If so, please leave a comment below with your results or questions.
Happy Analyzing!
Pingback: Troubleshooting a recent ASP.NET MVC, WCF, SQL App Performance Issue – DOTNET CATCH