Connect with us

PHP script to prevent Google AdSense click bombing

solution

PHP script to prevent Google AdSense click bombing

“God my AdSense account is disabled.I don’t know what happened.!”This was the question that i was hearing for about a month now.Yes it’s true.A lot of people are loosing AdSense account due to invalid clicks and click bombing by AdSense bots.It’ s pretty disheartening to know that the hard put efforts are lost due to somebodies unacceptable wishes.So what to do.How to prevent click bombing? How to Stop invalid clicks by AdSense bots.And finally i figured out an answer to this question.

AdSense Click Bombing – What & How

AdSense click bombing arise when Google ads are clicked many time within a given time gap by either a human or a bot.Google AdSense TOS is strictly against invalid clicks and Google have advanced infrastructure to identify any type of invalid click risen.It is almost impossible to evade the eyes of Google  According to AdSense TOS the publisher is responsible for preventing Invalids click and if any invalid clicks are generator, the whole fault is dumped into the shoulders of the helpless publishers.

Google is strict and they have explicitly told that invalid clicks could get your account banned. And if some people start to click bomb on your site ,there is nothing much you could do rather than to helplessly see the Hard earned AdSense account slipping away from your hands.

There have been a lot of people who has lost their AdSense account due to this terrible vex. And when you know that they are the topmost bloggers, you will realize how hard the situation has become.

How to Prevent AdSense Click Bombing using a PHP Script?

I was damn afraid of loosing my AdSense account. It was a necessity to develop a script that could prevent AdSense click bombing. Hence i came up with the below php script to stop AdSense invalid clicks.

Step 1: Register an Account at Statuscounter
Status counter will ensure that the ip of the visitors reaching your sites are noted. And you can check from which IP you are getting More frequent hits [ 25+ or so-be logical].

Note down the Ip addresses. Now look at the script below.

Step 2: Add this at the top of your WordPress with all the IPs you have taken from the stat counter.

<?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>';
}
?>

This script will block AdSense ads to those IP address that you have mentioned in the script there And will only show an unclickable ad to those Click Bombers. This way you can prevent AdSense click bombing.

Continue Reading
Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

More in solution

    About Me:

    Szabi Kisded

    Hey there, I'm Szabi. At 30 years old, I quit my IT job and started my own business and became a full time WordPress plugin developer, blogger and stay-at-home dad. Here I'm documenting my journey earning an online (semi)passive income. Read more

    Sign up for my newsletter and get the YouTube Caption Scraper WordPress plugin for free
    (worth 29$)!

    All My Plugins In A Bundle:

    My AutoBlogging Plugins:

    My Online Courses:

    A Theme I Recommend:

    Featured Posts:

    To Top