Browsers, How to, Web Designing

How to avoid accidental clicks on your own Adsense ads

This is the biggest issue and reason for many Adsense users getting banned,Clicking on own ads accidentally.Some times when checking out your own site,you may be tempted to click on an attractive ad,may be intentionally or accidentally.As google tracks all users with cookies these clicks are treated as accidental or fraud clicks and there is a chance of getting banned by google Adsense.Getting an account approved again is not so easy.To tackle this one must be very cautious when checking your own site.Or there is yet another simple way!The greasemonkey script.

To install greasemonkey,

  • First you must be using Firefox,Chrome or Safari to do the trick!
  • You need Greasemonkey add-on for your browser.(ignore if you already have it.)
    • If you use firefox click here to download Greasemonkey!
    • if you use Google Chrome,click here to download Greasemetal!
    • Using Safari,then click here to download Greasekit!

You can use a greasemonkey script so that when you view your own site,Adsense ads will not be visible.Thus eliminating the chances of accidental clicks.Sounds cool isn’t it?Actually the original script by Carlo Zottmann disables adsense on all website.In the sense it will not be visible to you.You are not actually editing the original site in any way.So don’t worry.

To disable adsense ads from showing up on a particular site,say your site,use the greasemonkey script given below.Or install automatically from HERE.Make sure you edit the installed script to change the default domain name.

/*
    Hide Google Adsense Ads
    (c) Carlo Zottmann, carlo@g-blog.net
    http://G-Spotting.net/
    Edited by Tharun, http://technostreak.com
    Copy, use, modify, spread as you see fit.
*/

// ==UserScript==
// @name            Hide Google Adsense Ads
// @namespace       http://docs.g-blog.net/code/greasemonkey
// @description     (2005-03-30) Hides Google Adsense Ads iframes anywhere.
// @include         http://yourdomainname.com
// @include         http://*.yourdomainname.com
// ==/UserScript==

(function() {

    var RemoveGoogleAds =
    {
        checkPage: function()
        {
            currentDoc = document;

            try {
                if (currentDoc.getElementsByTagName("body")[0].innerHTML.match(/google_ads_frame/i))
                {
                    this.injectCSS("iframe[name='google_ads_frame'] { display: none; }");
                }
            }
            catch(e) {}
        },

        injectCSS: function(css)
        {
            head = document.getElementsByTagName("head")[0];
            style = document.createElement("style");
            style.setAttribute("type", 'text/css');
            style.innerHTML = css;
            head.appendChild(style);
        }
    }

    RemoveGoogleAds.checkPage();

})();

Change the text yourdomainname.com to your own and the script is for you.Dont forget to change the protocol to https if you use a secure protocol(most of the sites do not).This script eliminates the chances if invalid impressions and accidental clicks.So your Adsense will be safe from your side.

Remember that the script is installed locally on the browser you use only.When you use another computer or another browser on same computer,the script wont work.You must install there seperately.

Hope the Trick was useful.Make sure you share it and also leave a comment if it really helped you.Subscribe for our newsletter to be notified on more tricks.

About the Author

Tharun is a bit attracted towards computers and stuff.He loves to blog,share and know more about computers and technologies.He shares what he feels is something good on this site...Stay connected.
Tharun is on: Facebook , Google+ , Twitter

7 comments
iosfixboy
iosfixboy

Useful dude but how can we integrate this on a blogspot site?

Olawale Daniel
Olawale Daniel

Thanks a lot for this awesome post @Tharun, this is informative and It will help most bloggers from falling under the AXE of Google.

Thanks for the share :)

Amaan Rizwan
Amaan Rizwan

Buddy,THis is somethign nyc...Will it run on blogger too ??If not then soon publish something for that also !!

Arjun
Arjun

Wow! Thanks For Sharing! Nice stuff to prevent accidental clicks on my own ads.

Tharun
Tharun

This is nothing in connection with the blogging platform or type of website you have.This is a browser script which you personally install,and the code is injected locally when you load the page to make the ads disappear.just install greasemonkey for your browser as said and then the script and you are done.