Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-settings.php on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-settings.php on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-settings.php on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-settings.php on line 530

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-includes/cache.php on line 103

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-includes/theme.php on line 623

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-content/plugins/tantan/tantan_reports.php on line 143

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-content/plugins/tdo-mini-forms/admin/tdomf-form-hacker.php on line 79

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-content/plugins/tdo-mini-forms/admin/tdomf-form-hacker.php on line 118

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-content/plugins/tdo-mini-forms/admin/tdomf-form-hacker.php on line 122

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-content/plugins/tdo-mini-forms/admin/tdomf-form-hacker.php on line 126

Deprecated: Assigning the return value of new by reference is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-content/plugins/tdo-mini-forms/admin/tdomf-form-hacker.php on line 130
How To Stop Stat Trackers From Counting Your Hits

Wednesday, April 11th, 2007...8:28 am

How To Stop Stat Trackers From Counting Your Hits


Deprecated: Function eregi() is deprecated in /nfs/c02/h06/mnt/46791/domains/thewrongadvices.com/html/wp-content/plugins/tpbc.php on line 96

If you visit your own site alot like I do, you’ll quickly find you skew your stats with all the extra pageviews and hits. There is an easy way to stop that from happening.

If you’ve played around with Wordpress a bit you’ll know it has different user levels. The most powerful user level is that of admin, which is level 10. Assuming your login is set to “Remember Me”, this is always going to be you, so it’s a simple matter of inserting some php code to check if the current user is level 10 (you), and if it is then the stats code doesn’t get loaded.

The following is the code you can use.

<?php
    get_currentuserinfo();
    global $user_level;
    if ($user_level != 10) {
        echo "
        PUT YOUR STATS CODE HERE
        ";
    }
?>

Update:
This is why you shouldn’t write at 3am. You forget things. Some people have been getting parsing errors when they use this code. I forgot to mention you need to add a back slash \ before any quotation marks (” or ‘) in the stats code you paste in. Sorry about that.

Update #2:
I figured out why some of you were still getting parse errors. This time it wasn’t my fault. It was due to the way Wordpress was formatting the quotation marks. I’ve made another change to the code, and now you should be good to go.

4 Comments

  • I still get the error.

  • Syaf if you want send me the code you’ve got and I’ll have a look. You can send it to me here.

  • I can’t resist saying this because I know many people are thinking it:

    “It only skews the tracking stats if you are the only one reading your blog!”

  • The stats counter I use allows me to block myself as a visitor so I just do that. I track several blogs using that counter and it works.

    By the way - found you on Duncan’s recent post about Aussie Bloggers. I’m in Melbourne and manage a number of blogs but only one has ‘Australian’ content. All the rest are business or personal interest topics.

Leave a Reply

You must be logged in to post a comment.

Blogarama - The Blog Directory Personal Blogs - Blog Top Sites Link With Us - Web Directory