The Ruby on Rails experts

Jul 8, 2013

This Google article explains how to measure Bounce Rate more accurately by adding an event that gets fired after, e.g., 15 seconds on page. Any visit during which this event gets fired is not considered a bounce. No additional setup required.

Here is the code (setTimeout):

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
  _gaq.push(['_trackPageview']);
  setTimeout("_gaq.push(['_trackEvent', '15_seconds', 'read'])",15000);
 
  (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>

Link: Tracking Adjusted Bounce Rate In Google Analytics – Analytics Blog via analytics.blogspot.ca