Search code examples
google-analyticsanalyticsappharbor

Google Analytics SiteSpeedSampleRate


I want to track 100% of the timings for every page view since my site doesn't have too much traffic, ~1000 views per week. I read that the siteSpeedSampleRate defaults to 1%, that doesn't get me very many samples.

Most of the documentation that I found is for the old ga.js version, I'm using the analytics.js version (which I believe is still in beta). Anyway, what's wrong with my syntax here? I'm still not seeing any samples since I implemented this change this morning...Do I need to do something different since my site is hosted on Appharbor?

ga('create', 'UA-xxxxxxxx-x',
      {'cookieDomain': 'apphb.com',
       'siteSpeedSampleRate': 100});

Here's a page I've been using for my syntax, I found another page that shows how to setup multiple parameters here.


Solution

  • Try this way,

    In your Tracking code ga.js

    ....
    _gaq.push(['_setAccount', 'UA-xxxxxxxx-x']);
    _gaq.push(['_setSiteSpeedSampleRate', 100]);
    _gaq.push(['_trackPageview']);
    ....
    

    More Documentation


    analytics.js

    ga('create', 'UA-XXXX-Y', {'siteSpeedSampleRate': 100});  // Creates a tracker.
    ga('send', 'pageview');    // Sends a pageview.
    

    The first line calls the create command, and the second line calls the send command.

    More Documentation and Advanced Configuration