Jim Westergren
About me, my projects, SEO, Web Development and Personal Development since 2005
"If we did all the things we are capable of, we would literally astound ourselves." - Thomas A. Edison

Protect yourself from invalid Adsense clicks

Have you also heard of those horror stories of Google banning Adsense accounts for the smallest mistakes?

You have read the Terms and Conditions and you know the basics but what do you do when you show your friend your site on your computer and the first thing he does is to click the Adsense ad on your site? (actual example). Well you email Google Adsense and explain what happened, it will usually be no problem.

I recently made a WordPress CMS with Adsense and I have one staff working on it as well as other people, adding text and so on on many domains. The risk to click by mistake is very big ...

So I made this script

Add this at the top with all the IPs you have used to login to your Adsense account:

<?php
$ip = $_SERVER["REMOTE_ADDR"];
$ip_array = array("xxx.xxx.xxx.xx", "xxx.xxx.xxx.xx", "xxx.xxx.xxx.xx", "xxx.xxx.xxx.xx", "xxx.xxx.xxx.xx");
?>

Then on all the Adsense codes replace with the following:

<?php
if (in_array($ip, $ip_array)) {
	echo 'Blocked Adsense';
} else { ?>

Here comes the adsense code

<?php } ?>

That will display "Blocked Adsense" instead of Adsense on those computers with the same IPs you used to login to your Adsense account and you don't need to worry. On my CMS I made it to display non-clickable images of Adsense instead that looks just like Adsense so it doesn't look weird when my staff and writers looks at the sites.

If all else fails, check out the AdSense Reinstatement Guide.

13 Feb 2007

About the Author Jim Westergren Jim Westergren is a Swedish web entrepreneur currently living in Spain. He is happily married and has three lovely children. Some of his interests are web development, SEO and writing.
He is the Founder of DomainStats and N.nu. Read his .