If Your Web-Tracker Count Your Own Visit

If you own your own website, then most likely you have put a web tracker to calculate your visitors, where do they come from and so on. There is so much free web tracking service you can use to track your website like Google Analytics, Site Meter, and so on. The greatest problem on those web-tracking services, in my opinion, is they count your visit to your own website like counting the other visitors. That makes the data of your visitors contaminated with your own visit, moreover if you often reload your website while you are still developing it. You can’t get a pure data of your visitor because of it.

Most trackers have a feature of filtering visitors to be tracked. For example, Google Analytics have an IP address filter so any visit from specific IP address will be ignored, or Site Meter creates cookies on browsers so it won’t count visit from specific web browser. Maybe those feature aren’t good enough. My internet provider often change my IP address so I always have to define a new IP address to the Google Analytic filter each time my IP address changes. When you use various browser, it will be a problem for Site Meter unless you set the cookies for all your browser.

If you are using WordPress, here is a code you can use on your website…

<?php if ($user_level != 10) { include (TEMPLATEPATH . "/tracker.txt"); } ?>

Here is how this code works. The $user_level defines who logged in on your website. The admin is the only user with the user level 10, no one else. The conditional code means if you are not user with the level 10, it turns out to be a TRUE condition, in this case non-admin members and non-logged-in visitors. If it happens, then the file “tracker.txt” which is located on your WordPress theme directory will be called.

So the key is, as long as you logged in as admin on your site, the code won’t appear, just see the page source from your browser. I think this is the most effective way to avoid such website tracking failure. Besides, this is useful for web developers who often reload the website because the website will load faster for them.

Oh, you also can use this code on Google AdSense to avoid invalid click from yourself, just as long as you logged in.

Note
I don’t know why but this code won’t work if you use “get_header” function to call your header template. Just use the “include (TEMPLATEPATH . “/header.php”)”, it gives a same result…

Leave a Reply

faisalmalik1989's Journal contents are managed by WordPress, hosted by Dracoola, tracked by Google Analytics and WordPress Stat, RSS feeds burned by FeedBurner, design and layout by faisalmalik1989, small icons by pinvoke.