Get your RUM on, _setSiteSpeedSampleRate to 100

Google Analytics, Pingdom and WebPageTest combination

Google Analytics is a must for traffic analysis, understanding paths customers take through your site, tracking conversion rates and, of course, your site speed. Learn how to get 100% sampling for your site speed.

Google Analytics RUM

Get it for the RUM. That’s real user management. Make sure to set the _setSiteSpeedSampleRate or siteSpeedSampleRate (Universal) to 100%. If you don’t, you’ll only get page timings for 1% of your page loads.

<script type="text/javascript">
var _gaq = _gaq || [];
 _gaq.push(['_setAccount', 'UA-YOURNUMBER-1']);
 _gaq.push(['_setSiteSpeedSampleRate',100]);
 _gaq.push(['_trackPageview']);   (function () {
var ga = document.createElement(‘script’);
ga.type = ‘text/javascript’; ga.async = true;
 ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
 var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();
 </script>

OR, if you’ve upgraded to Universal:

<script>
  (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-YOURNUMBER-1', {'siteSpeedSampleRate': 100});
  ga('send', 'pageview');
</script>

Here’s the help page:
https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#siteSpeedSampleRate

Tip: If you’re a WordPress user, like me, and are using the Google Analytics plugin in WordPress, use the Plugin editor to edit the “googleanalytics/googleanalytics.php” file and inject ” _gaq.push([‘_setSiteSpeedSampleRate’,100]);” right in the right spot.

Screen Shot 2014-07-29 at 5.07.39 PM

Or, if you’re using Universal Analytics, change out the entire block of JS like this:

Screen Shot 2014-08-01 at 8.58.11 AM

Written By at .

Leave a Reply

Your email address will not be published. Required fields are marked *