Editor's note:
Thanks for visiting GA Tip of the Day. Please see current posts on the Cardinal Path blog.

“Adjusted” Blog Bounce Rate with Customized Tracking Code

In our previous post, we discussed the high bounce rate that, by default, you can expect to see for your blog. In today’s post, we review a way to customize the Google Analytics Tracking Code (GATC) so the bounce rate for your blog – or for any primarily single-page website – represents user activity more accurately.

Because the GATC is written in JavaScript, we can incorporate native JavaScript functions, such as setTimeout, which calls another function after a specified delay.

Here is what’s happening with the customized GATC below:

  1. The GATC generates a regular pageview when the page loads.
  2. Using setTimeout and _trackEvent, we’re setting an event to execute 15 seconds after page load. (The “15000″ parameter represents milliseconds and equates to 15 seconds.)
  3. If the visitor stays on the page for 15 seconds, the event fires, and Google Analytics no longer considers this visit to be a bounce.

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-1']);
setTimeout("_gaq.push(['_trackEvent', 'adjusted-bounce', 'read','15-seconds'])",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);


If possible, it would be slightly preferable to call setTimeout within the GATC on
the home page only, but there is not much harm if it’s included on every page of your blog, since the event is significant mostly for Bounce Rate calculations and not in itself.

Thanks to the official Google Analytics blog for introducing this technique for adjusted bounce rate. (Unless your own blog is very heavily trafficked, I wouldn’t be overly concerned about the caveat at the end of that blog post.)

Please share this post:
Facebook Twitter Plusone Linkedin Email

One thought on ““Adjusted” Blog Bounce Rate with Customized Tracking Code

  1. Pingback: Use JavaScript setTimeout() to Create Time-on-Page Goal | Google Analytics Tip of the Day

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>