How To Keep Your Blogs Statistics Accurate

ADVERTISEMENTS

Everyone who has a site check their stats from time to time to know how their site is performing. I know I check my site’s stats almost every hour.

I also check my site’s homepage and posts from time to time to ensure that there are no spelling mistakes and other problems like image not displaying properly.

But by doing this we are rendering our own stats inaccurate.

How to fix this

Almost every stats package you would try requires you to insert a little chunk of Javascript (or similar) into your template, usually at the bottom so it’s the last thing that loads.

All you have to do is tell your Content Management System (CMS) to not include that code if you are logged in. That way your own hits aren’t logged so your stats more accurately reflect how many visitors your site is getting and what they’re looking at.

For those of you who use WordPress this is very simple. The function that you need to let WordPress determine whether or not to include this code is the is_user_logged_in() function. So your code should look like this:

< ?php if(!is_user_logged_in()) { ?>
Insert your stats package inclusion code here�
< ?php } ?>

This will work no matter where your code has to be included, and will work each and every time whenever you’re logged in.

via Jonic’s Blog

banner

Search JohnTP.com or view a random post

To receive this blogs articles for FREE on your email inbox, just enter your email address below and click 'Go':

Enter your email address: or .

Find out what I am doing currently by .

4 responses so far,

  1. 1

    Aaron Brazell

    May 9, 2006 at 3:55 pm

    That was a great article Jonic wrote. I saw it there the other day. One suggestion would be to wrap his content in

    tags so readers know it’s an excerpt. :-)

  2. 2

    johntp

    May 9, 2006 at 4:16 pm

    I have already linked to his post, which means the entire credit goes to Jonic :-)

  3. 3

    Keith Dsouza

    May 12, 2006 at 9:11 pm

    Hey John,

    This tutorial is nice, I already have blocked my site with the inbuilt Joomla plugin to debar page hits counted from my IP since the day i started my site.

    But still I have one doubt and don’t think the entire article is accurate as the user’s stats contain two things one is unique page hits and total page views and this article will definitely help with the total page views being inaccurate in your stats.

    But i still don’t think this will help you in regards to unique user’s page hits as obviously unique page hits are accounted on different ips hitting your site.

    I am already halfway through this new article to be published on my site tomorrow, a indepth analysis as to what your stats tell you.

    Keith

  4. 4

    johntp

    May 12, 2006 at 11:02 pm

    I was thinking of using this for Google Analytics until I found out it’s filter option.



    Copyright ©2005-2008 JohnTP, All rights reserved.