How to Fix Google Analytics to Properly Calculate Bounce Rate

Google Analytics is broken. Well, at least the way that Google Analytics calculates bounce rate and the average time on site is broken–or at least has a major flaw.

Let’s first take a look at bounce rate, and how Google explains it:

There is a difference between exit rate and bounce rate. But what we really want to know is bounce rate–how many people really did engage with us on our website. How many people read our content. As a blogger, if someone reads your post and then goes to another site, then fine. If they click on another link on your site and go to another page, then they’ll be “engaged” and won’t bounce according to Google. But what about those people who actually read–they have engaged on your site, right?

Let’s talk about a specific example so I can explain why Google Analytics’ bounce rate is flawed.

When someone visits your website and reads your blog post, for example, they may spend 3 minutes reading it. But then they leave, and go on to another website. If you are using Google Analytics, Google Analytics measures the time someone spends on your site reading a blog post as the difference between when they first entered and his last page view on your site. So, if the person actually leaves your website after 3 minutes, Google Analytics consider this person as not engaged with your site–it is considered a bounce.

DNMedia.com has just written about this flaw in Google Analytics, and how to add some code to your Google Analytics code that will fix this flaw. Essentially, the code will ‘ping’ Google every 10 seconds (or at an interval you can set in the code) so that Google knows that they’re still on the site.

Here’s the code that Brian Craw wrote a while back. All you have to do is add this code to your current Google Analytics code (at the end), just before the < / script > line:

(function (tos) {
  window.setInterval(function () {
    tos = (function (t) {
      return t[0] == 50 ? (parseInt(t[1]) + 1) + ':00' : (t[1] || '0') + ':' + (parseInt(t[0]) + 10);
    })(tos.split(':').reverse());
    window.pageTracker ? pageTracker._trackEvent('Time', 'Log', tos) : _gaq.push(['_trackEvent', 'Time', 'Log', tos]);
  }, 10000);
})('00');

Note: I realize that the code above might look like it’s cut off, but if you copy/paste it you should be able to grab the full code. You might also want to go here to Brian’s original post to grab the code.

You can change the interval of calculation here so that it’s not 10 seconds, but more often or less often. In other words, it will track an event (log that the person is still on your site) every 10 seconds.

The end result is that by adding this additional code to your Google Analytics tracking code (it works with the old and the new code) you’ll be able to fix how Google Analytics calculates the bounce rate on your site.

Hat tip goes out to DNMedia.com and Brian Cray for pointing this out.

UPDATE:
OK, so it’s been a while since I first posted this blog post and I added the code (as detailed above) on the site here. I’m sure you’re wanting to know if adding code actually helped the bounce rate? Well, it didn’t necessarily HELP the bounce rate, the bounce rate is what it is. But, I could say that it is calculating the bounce rate MORE ACCURATELY than it did previously. Here are my preliminary stats, according to Google Analytics. I compared traffic WITH the code versus not having the code.

Avg. Visit Duration
1,048.61%
00:09:15 vs 00:00:48
People are actually spending 9:15 minutes on my blog, not 48 seconds as previously reported by Google Analytics.

Bounce Rate
-52.28%
40.13% vs 84.08%
The bounce rate went from 84 percent (wow that’s high) to 40 percent (that’s more like it!)

Comments

  1. Ash Nallawalla says

    Great article, Bill. This will also help with AdWords where you have changed the landing page from the home page to a more suitable inner page. Originally the visitor had to navigate from the home page to a better page. After taking away that step, the bounce rate will shoot up for the same reason as your example. By using your (and Brian’s) tip, we can now get a truer bounce rate.