Jim Westergren
A blog about me, my projects, SEO, Web Development and Personal Development.
"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 {
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.

Tweet this! Boomark This! Subscribe to the RSS feed
About the Author Jim Westergren Jim Westergren is a company owner from Sweden who lives together with his wife and son. Some of his interests are SEO, web development, writing and taking photos. Read his full about page or contact him. Follow Jim on Twitter or subscribe to this blog.
In Swedish: presentation, blog.
26 responses »Leave a comment
  1. Brian Pratt
    said on February 14, 2007 at 12:21 am

    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

  2. Jim Westergren
    said on February 14, 2007 at 1:28 pm

    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.

  3. Maki
    said on February 16, 2007 at 12:07 am

    Thanks for the great tip. Was previously using the greasemonkey script for preventing accidental clicks but this works just as well.

  4. Thermage
    said on February 18, 2007 at 5:57 pm

    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)

  5. eli
    said on February 19, 2007 at 12:41 pm

    simple but very useful tips. thanks

  6. Australia immigration
    said on March 26, 2007 at 8:55 am

    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 ? :)

  7. Michael
    said on March 26, 2007 at 11:42 am

    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.

  8. Strafverteidiger Freiburg
    said on May 2, 2007 at 1:58 pm

    Very great info. i will protedt us now as well.

  9. my conversations with adsense team
    said on June 5, 2007 at 11:16 am

    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.

  10. Dog
    said on June 28, 2007 at 10:48 pm

    It is very helpful tip!

    Thank you very much!

  11. ODLS
    said on October 24, 2007 at 6:36 pm

    One of the biggest worries for webmasters if you get banned for something that was really unintentional. Thanks for the tip.

  12. Aelizia
    said on November 5, 2007 at 11:11 am

    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.

  13. youtube
    said on December 14, 2007 at 8:57 am

    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.

  14. Bob Mill
    said on December 19, 2007 at 8:55 pm

    This is very useful script! I will post it on my website – check it out at http://www.ad-sensing.com

  15. Google Horror Stories
    said on March 21, 2008 at 4:02 pm

    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..

  16. Don
    said on April 1, 2008 at 4:29 am

    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

  17. Ealtamira
    said on June 4, 2008 at 10:00 am

    Nice trick, but I don’t think adsense was so evil

  18. Patrick
    said on July 26, 2008 at 11:40 pm

    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.

  19. Eunus hosen
    said on July 4, 2009 at 10:23 am

    Thanks. If i have 3 ad unit in a page what can i do? How I install this code?

  20. irfan
    said on March 6, 2010 at 11:33 am

    ya i think adsense click locker is the best solution against click bombing,but unfortunately its not free

  21. 2FUN BD
    said on March 27, 2010 at 7:53 pm

    Its a nice Info. Thank you For share this.

  22. Man health
    said on May 22, 2010 at 9:07 am

    I think disable java script will be enough

  23. Faceeee
    said on August 30, 2010 at 5:56 am

    Does google allow this coding?

Leave a Comment

To quote: <blockquote>text to quote</blockquote>

You can use these tags: <a href=""> <blockquote> <code> <em> <strong>


To have a photo of you beside your comments, upload a photo here.

Pingbacks
  1. [...] But wouldn’t be nice if you weren’t clickbombed in the first place?  Thats where code such as this by Jim Westergren comes into handy.  This code will limit multiple clicks by IP and shut down your click bomber before he gets a chance.  The problem is that this can shut down legitimate clicks.  Do you have code that you use to protect your Google Adsense account, feel free to share! [...]

    Pingback by Protect your Adsense account from Invalid clicks — December 19, 2007 @ 7:49 pm

  2. [...] For more info see the source [...]

    Pingback by Top of Review ’s » Protection from invalid Adsense clicks — February 12, 2008 @ 4:05 am

  3. [...] your ads, it will automatically display another advertisement instead. For more details, click here. Please let us know if you know anymore valid JavaScript we can use to prevent invalid [...]

    Pingback by Protect Your AdSense Account from Click Bombing Invalid Clicks | Webmaster Crunch — August 2, 2010 @ 8:17 pm

Previous post in category:

Next post in category:

Design by myself:  valid XHTML and valid CSS.