Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enabling page load samples for Google Analytics Site Speed

When I look at Behavior | Site Speed |Overview in GA I get the message:

"0 of pageviews sent page load sample"

How are these enabled? Or is this a ga() call you have to make from DOM Ready?

Thanks

like image 980
Steve Avatar asked Feb 20 '15 13:02

Steve


People also ask

How fast should a page load Google?

If you want a quick answer, the Google recommended page load time is under two seconds: “Two seconds is the threshold for ecommerce website acceptability. At Google, we aim for under a half-second.”

What is a good page load time Google Analytics?

TLDR Answer: Serve your customers with the page load time they need, a good goal being 1-2 seconds.

How can I speed up my Google Analytics?

You can speed up sites using Google Analytics with two simple changes. Move your analytics code to the bottom, and localize the JavaScript file. This article showed the effect of these changes on a real-world example with waterfall graphs.

How do I get page load time in Google Analytics?

Page Timings & User Timings reports > Distribution tab To get the speed detail for a specific page or resource, you can drill down into the item in the Explorer tab, and then click the Distribution tab to see the distribution of load/execution times.


1 Answers

You need to set your sample set higher. I believe the default is only 10%. I'll paste code below once I get it from my BitBucket repo.

Notice the "siteSpeedSsampleRate" property. I set mine to 100% because I'm greedy and want to know about ALL page views. Helps when I don't have more than 100k page views per month...

(function (i, s, o, g, r, a, m) {
    i['GoogleAnalyticsObject'] = r;

    i[r] = i[r] || function () {
        (i[r].q = i[r].q || []).push(arguments);
    }, i[r].l = 1 * new Date();
    a = s.createElement(o),
        m = s.getElementsByTagName(o)[0];
    a.async = 1;
    a.src = g;
    m.parentNode.insertBefore(a, m);
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');

ga('create', 'UA-xxxxxxxxx-x', {'siteSpeedSampleRate': 100});
ga('require', 'linkid', 'linkid.js');
ga('send', 'pageview');

FYI - this is the part that is needed:

{'siteSpeedSampleRate': 100}
like image 87
ganders Avatar answered Dec 14 '22 23:12

ganders