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.

Boomark This! Subscribe to the RSS feed
About the Author Jim Westergren Jim Westergren is a web entrepreneur from Sweden now living in Bolivia. He is happily married and has two lovely children. Some of his interests are web development, SEO and writing. He is the Founder and CTO of TodaysWeb and his current major project is N.nu. Read his . Follow Jim on Twitter or Google+.
  • http://www.bestrealincome.com Brian Pratt

    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

  • http://www.jimwestergren.com/about-me-jim-westergren/ Jim Westergren

    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.

  • http://www.doshdosh.com/ Maki

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

  • http://www.Klinik-Falkenried.de/hautverjuengung.htm Thermage

    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)

  • http://www.blueseo.com eli

    simple but very useful tips. thanks

  • http://www.emigration-center.net Australia immigration

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

  • http://www.oddblog.de/ Michael

    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.

  • http://www.anwaltskanzlei-strafrecht.com Strafverteidiger Freiburg

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

  • http://hiteshsahni.blogspot.com/2007/06/in-conversation-with-google-adsense.html my conversations with adsense team

    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.

  • http://www.uniquedogclothing.com/dog-tshirts.html Dog

    It is very helpful tip!

    Thank you very much!

  • http://www.outdoorlivingsupplies.com ODLS

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

  • http://www.logoangel.com Aelizia

    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.

  • http://www.rizecity.com youtube

    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.

  • Pingback: Protect your Adsense account from Invalid clicks

  • http://ad-sensing.com Bob Mill

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

  • Pingback: Top of Review ’s » Protection from invalid Adsense clicks

  • http://www.googlehorrorstories.net Google Horror Stories

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

  • http://www.adsenseclicklock.com Don

    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

  • http://ealtamira.com Ealtamira

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

  • http://www.onyxbits.de Patrick

    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.

  • http://www.bd4you.blogspot.com Eunus hosen

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

  • http://Peakfun.blogspot.com irfan

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

  • http://www.2funbd.com 2FUN BD

    Its a nice Info. Thank you For share this.

  • http://www.manhealth.us Man health

    I think disable java script will be enough

  • Pingback: Protect Your AdSense Account from Click Bombing Invalid Clicks | Webmaster Crunch

  • http://www.faceeee.com Faceeee

    Does google allow this coding?

  • http://www.philtalks.com PhilTalks

    do you have a script which will limit the clicks? so that users cannot make multiple clicks on your ads. Thanks :D

  • Pingback: [How-To] Protect Your Blog From Adsense Invalid Clicks | TechInfo Blog

  • http://wellbeing-support.com Ana

    Thanks Jim. I will try this one after i got banned from google adsense because someone clicked more than 100 times on the add.

    Ana is wellbeing writer

  • oxi

    Hi, interesting piece of code!

    I’m currently looking into ways to effectively prevent click-bombing, BEFORE I go into the AdSense venture!

    I would like to limit showing Ad units, to let’s say 1 click per IP per day, then use javascript to hide the Ads after first click, along with PHP to hide them for 1 day for that IP.

    ***I just have this concern since I have no experience with Adsense at all: What if a click-bomber copies a link in your Ads -which as far as I understand it contains all your referer info, etc- prior to actually clicking it, then paste and open this link subsequently and repeatedly in his browser address bar? Wouldn’t this be just like clicking on your ads? So then it wouldn’t matter whether you hid them or not!!***

    I’m willing to believe that Google uses some kind of unique-click hash code generator to prevent the aforementioned. But could someone confirm this to me, please? Much, much, much appreciated!

    For obvious reasons, just in case they don’t have this kind of unique click hash code, I don’t want to post this question in Google forums. Although, that would be the place to ask, really.

    Hope someone can illuminate me!

    Regards,
    oxi

  • http://www.ikonwebdesigns.com surinder

    if you need to know how to create google adsense account easily , come to my blog http://www.ikonwebdesigns.com/blog

  • Pingback: [How-To] Protect Your Blog From Adsense Invalid Clicks « Plugins « Wordpress « Baguzajja[dot]Info Personal Site Blog

  • Pravat

    how to implement the codde on blogger..

  • http://www.livejar.blogspot.com Robiul Hasan

    How can place the code on my blogspot site?

  • http://www.psiquo.com/ coaching

    is possible to implement the codde on blogger?
    tahnks

  • http://www.tekkianswer.com ramel.d

    Interesting tips! although this is old post, I will try this code. I need to prevent click-bombing. My friend’s adsense was blocked due to it.

  • http://www.facebook.com/karan.khandelwal1 Karan Khandelwal

    Does this work on non-php sites?

  • http://www.jimwestergren.com/ Jim Westergren

    No, PHP code does not work on non-php websites.

Previous post in category:

Next post in category:

Design, text and custom cache solution by myself.

Page generated in
0.0029 sec