Skip to content

Instantly share code, notes, and snippets.

@simondahla
Last active August 4, 2018 17:45
Show Gist options
  • Save simondahla/7135684 to your computer and use it in GitHub Desktop.
Save simondahla/7135684 to your computer and use it in GitHub Desktop.
Set proper Sample Rate for Site Speed http://blog.mythly.com/improve-site-speed-in-google-analytics/ Note: Google will automatically cap the sample rate to 10k pageviews a day.
_gaq.push(['_setSiteSpeedSampleRate', 100]);
ga('create', 'UA-XXXXXX-Y', {'cookieDomain': 'example.com', 'siteSpeedSampleRate': 100});
@benoitpointet
Copy link

benoitpointet commented Mar 14, 2017

It seems GA also does also sample timing hits on their servers: https://developers.google.com/analytics/devguides/collection/analyticsjs/user-timings#sampling_considerations

Did you take that into consideration as well?

@oshrim8
Copy link

oshrim8 commented Sep 15, 2017

Hey. What is this part used for:
'cookieDomain': 'example.com', ?
My analytics.js is hardcoded (not GTM), should I replace the:

<script> . . . . ga('create', 'UA-XXXXXXXX-2', 'auto'); <---- replace this? how? ga('send', 'pageview'); </script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment