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 {
echo '<Here comes the adsense code>';
}
?>
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.

Jim Westergren is a company owner from Sweden who currently lives in Bolivia with his wife. Some of his interests are SEO, web development, writing and
Hi Jim
Nice tip thanks.
Another option is to install an adserving script like openads (http://www.openads.org/).
There is a GEOIP file available which will allow you to not show ads to particular countries or even cities.
Some hosts have this script as part of their fanastico build.
You then just serve adsense with the script & all is taken care of.
It also has other options like only showing an ad to a user once every 30 seconds or only showing an ad max 3 times to a visitor in one day etc.
Hope this helps
Regards
Brian
Thanks Brian, that could be useful for more advanced uses.
Another use is to not serve ads to those coming from social network siteso to increase the vote percantage.
Thanks for the great tip. Was previously using the greasemonkey script for preventing accidental clicks but this works just as well.
A very interesting site, I think. The Idea of Technology was new for me but worth to be read and thought abot it (although I’m not a native english-speaker and have some difficulties whith this language)
simple but very useful tips. thanks
your method can only apply to the lease line or fix IP address, for those who is not using fixed IP address to go online, It may be useless. I found using adlogger will be an better solution because it can block the range of the IP address for example 60.xxx.xxx .
what do you think ?
You could also install adlogger. There you can also add ips to a list so that ads are not shown for people who visit your website with these ips.
Very great info. i will protedt us now as well.
well I don’t think we need to be as much careful about accidental clicks.The adsense team knows that this could happen.I have myself consulted adsense for this purpose.You can see my full conversation with the adsense support team.
It is very helpful tip!
Thank you very much!
One of the biggest worries for webmasters if you get banned for something that was really unintentional. Thanks for the tip.
Hi,
Its a useful tip.Actually i am looking information regarding Adsense click and i am glad i found your blog.I am going to use this Adsense script right now. Thanks for the valuable information.
Thanks Brian, that could be useful for more advanced uses.
Another use is to not serve ads to those coming from social network siteso to increase the vote percantage.
This is very useful script! I will post it on my website - check it out at http://www.ad-sensing.com
That is a nice tip.. But what would be even better is if google would just ignore clicks generated by the adsense publisher.. And ignore clicks from obvious click bomb attacks.. Google is supposed to be a tech leader and they cannot do this? All they can do is ban adsense publishers for simple mistakes like accidentally clicking on their own ad. Give me a break..
Hi Jim,
Cool idea! If someone wanted to take it a step further and actually block ad views and even page views by using cookies and IP tracking they could get a script like AdSenseClickLock from http://www.AdsenseClickLock.com.
The script is very easy to install and can help prevent invalid clicks and potentially save an account from getting banned.
Thanks,
Don
Nice trick, but I don’t think adsense was so evil
Personally, I prefer to use Firefox with the Adblock Plus plugin. The big advantage is, that I do not use to put the two class B subnets of my provider in that array
and can easily check, if ads and content match.
Thanks. If i have 3 ad unit in a page what can i do? How I install this code?