Adsense Invalid Click Protection in Blogger

Adsense Invalid Click Protection in Blogger

Is your website affected by invalid clicks on your AdSense ads? It might be due to a mistake or some of your haters might be doing this.

Have you searched for the solutions and haven't found any? Ok, now the time is gone, you can have control over invalid clicks on the ads on your website.

In this article, I am going to tell you how you can add a functionality to notice invalid clicks on your AdSense ads.

You might have seen this functionality on many websites and you want to implement it on your website and you are not finding the exact source which teaches you to set up Adsense invalid click protection on your blog or website.

What about WordPress users?

You can find plugins to do so but if you can't find any, don't worry you can follow the same steps if you are using WordPress or any other CMS.

We can add this functionality using different programming languages but as you know that in blogger only JavaScript is supported so we are going to use JavaScript to add invalid click detection functionality in our website.

We will see how we can implement this functionality into our website this article is all about it but before that let's talk about some impacts of invalid clicks.

What are the impacts of invalid clicks?

  • Disabling of AdSense account
  • Mostly your ads are limited
  • Your earnings are disturbed

there might be many of them.

How this script works?

This script just takes control of the iframe as Adsense ads are shown in iframes, detects the user interaction on iframes that contains Adsense ads and counts the number of clicks, and stores them in cookies in the user's browser.

Setting Up Steps:

  1. Go to Blogger Dashboard
  2. Go to Theme/Template Section
  3. Click Edit HTML
  4. Now Search for </body>
  5. To search anything in blogger template section press Ctrl+F and then type term to search and press enter.
  6. Now copy the code provided below and add it before the tag which we have searched in step 4.
  7. <script>
       var limitClick = 5;                  // Maximum Clicks per User
       var idAdsense = 'CUSTOM_TAG_ID';    //Adsense Ad Container Element ID
    </script>
    <script async='async' src='//cdn.jsdelivr.net/npm/blogspot-clickfraud@0.0.4/index.min.js'/>
  8. Now wrap your AdSense ad code in an element with CUSTOM_TAG_ID, it must be the same as in the script above.
  9. Your ad code looks like this after wrapping.
    <div id="CUSTOM_TAG_ID">
      <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
    <ins class="adsbygoogle"
         style="display:block"
         data-ad-client="ca-pub-XXXXXXXXXXXXXXXX"
         data-ad-slot="XXXXXXXXXX"
         data-ad-format="auto"
         data-full-width-responsive="true"></ins>
    <script>
         (adsbygoogle = window.adsbygoogle || []).push({});
    </script>
    </div>
  10. Save Theme/Template and you are done.

Configurations:

You must change these configurations accordingly.

VariableDescription
limitClickNumber of click per user can do. ( Default 5 )
idAdsenseID of Adsnese adcode wrapper element.

Conclusion:

That's it now invalid click protection is added to your website. Make sure to edit the configuration setting.

Related Posts

M.Muzammil

I am Muzammil, a Self-taught Web Designer & Developer. I haven't yet completed my college degree. Started learning programming at the age of 12 and still learning. I love to work in Javascript and make eye-catchy designs. Free for your calls :)

13 Comments

Add Comment
Up Down

Hey, Brother your Template is awesome and posts are lit ๐Ÿ”ฅ..... ๐Ÿ’ช๐Ÿป

M.Muzammil

Thanks for your appreciation. I love to hear from you โค๏ธ

เฆคเฆพเฆนเง‡เฆฐ

Can i get your blog template plz ?

M.Muzammil

Sorry dear i can't. But i can teach you the way i made this awesome looking design.

Abhishek padhi

I think this code is not working. Tell me how it works to protect invalid click

M.Muzammil

Have you tested or not?

Sayem Miaji

keep this great work..๐Ÿ’œ๐ŸคŽ๐Ÿ–ค๐ŸคŽ๐Ÿ’œ๐Ÿ’™๐Ÿ’™๐Ÿ’š๐Ÿ’›๐Ÿงก

M.Muzammil

Thanks for your feedback.

Coding0toAdvance

How to create blogger theme looks like your website

M.Muzammil

Follow Blogger template development playlist on my YouTube channel.

Coding0toAdvance

Thanks bhaijaan ...

Coding0toAdvance

Can you give me this theme please

Coding0toAdvance

Good bro