enrii.blog

A passionate programmer’s findings in the world of internet.

I Hate To Be Tracked By Adsense

September 23rd, 2005

As what you can see on my blog, I'm a Google Adsense user. Checking Adsense statistic has been one of the activity I did frequently. In the Adsense report, I hate to see inaccurate page impression count because my own visits are included.

And, I thought of using cookies to avoid myself to be tracked. Here's how I do it (if you might be interested).

Firstly, I add a new php page (e.g. "myself.php") to the root of my wordpress with this code:

<?php
	// a cookie for 10 years
	setcookie('myself', 1, time() + 60 * 60 * 24 * 365 * 10);
?>

Then, I add the following code to each Adsense scripts:

<?php
	if (!isset($_COOKIE['myself'])) {
?>
<!-- Place your Adsense code here -->
<?php
	}
?>

After that, I point my browser to "http://blog.enrii.com/myself.php". Then, I don't see any Adsense ads anymore. I remove the "myself.php" after that to avoid other people to use it. This should work with site counter scripts (e.g. Statcounter) as well.

The down side of this is I need a second browser to test my ads placement or remove the "if" code out of Adsense script. Hope this helps somebody. Or, is there any better way?

If my article helped you solved your problem, consider buy me a beer!

Share this article: del.icio.us | digg it

Tags: ,

Related posts:

10 Responses


Leo Kent says:

That is actually quite a good idea, maybe it could even be turned into a WordPress plugin; that would also enable you to turn it on and off. The problem I have with Adsense is that I have two sites each using the same account and so I can’t tell which site has made the money.


EngLee says:

If that’s the case, you should use channelling function provided by Adsense. You only have to configure the website URL to track the performance of that site.


szehau says:

Instead of hidding the adsense code, you can also show an image which has the same size with the adsense ads:

Avoid additional Adsense impression from publisher

🙂


EngLee says:

Good idea. With that, you can do your adsense placement properly without having to remove the “if” statement.


Oliver Zheng says:

Oh my god. I just manually set a cookie to my Opera browser for your domain – now that ad is gone! I wonder how great the world would be if every site was like this 😛


EngLee says:

No.. No..! How possible is that when you don’t know the cookie name? I’m not using the example name (“myself”) for the cookie on my site!


Oliver Zheng says:

Oh really? Maybe it’s my Norton that blocked it 😛


boringest says:

why not just use adlogger? not only can you track your clicks but block multiple clicks and also stop your own browser from displaying them on your site.


EngLee says:

Sometimes, for such an easy stuff, I would like to do the programming myself, rather than using something I don’t know how it works.


Kelvin17 says:

Only the form of the supply is changed, not the total. ,