Making Google Analytics More Accurate

If you have Google analytics installed on your site, you’ll know how useful it is for finding out about your visitors and their activity. You can see unique visitors, clicks, bounce rate, time spent on site etc. Like the vast majority of Google products, its not 100% accurate, and its quite easy to hide your browsing from and analytics software.

There is also another issue with the time spent on site. This has become more important since the Panda/Penguin updates, and unfortunately, for the small website owner, it is weighted in the favour of bigger, corporate websites. This is due to it only counting the user time spent on site for the first minute (or so), before classing the user as inactive. So if a user comes onto your site, and spends 3 minutes reading an article, before clicking the back button, the whole 3 minutes isn’t counted towards the ‘Average Time Spent On Site’. The same goes if someone comes to your site, then clicks a link and reads. The whole time isn’t counted.

But don’t fear, there is a solution! By adding the code below to your footer file, before the last /body tag, it will inform Google ever 10 seconds that the person is still active on your site, up to 10 minutes. This way, all the time that someone spends reading your site is counted as well. So if a user coming to your site, and spends more time reading, than clicking, this code helps to improve you time spent on site stats.

<script type=”text/javascript”>
(function (tos) {
window.setInterval(function () {
tos = (function (t) {
return t[0] == 50 ? (parseInt(t[1]) + 1) + ‘:00’ : (t[1] || ‘0’) + ‘:’ + (parseInt(t[0]) + 10);
window.pageTracker ? pageTracker._trackEvent(‘Time’, ‘Log’, tos) : _gaq.push([‘_trackEvent’, ‘Time’, ‘Log’, tos]);
}, 10000);

This is a perfectly legitimate way of doing this, and is using Google’s own code for doing so. It is a white hat method (that’s good). It may not be the total solution for all. For example, if you site has a low average time spent on site, because people are clicking off it quickly anyway, then it won’t help you at all. However, if you have a blog/site that targets long tail keywords, where people land on posts and read what you have written, then it will be a great help for you.

After the first full day that it has been installed, you should start seeing results in your Google Analytics account. If you use Google real time, you will see instant results, as people leave their tabs open, viewing your website. In real time, live visitors time online is extended to 10 minutes with this code, rather than the standard 5.

Please note: For this code to work, you already need to have Google Analytics installed, and this code is used in addition to the standard GA code.

WordPress user need to put this in the footer.php of their theme, before the closing < /body> tag. All other platforms, it goes in the footer.

Many Thanks to our friends at SEO Forum UK for this info.