Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Prevent Invalid AdSense Clicks in WordPress (Step by Step)

If you’re running AdSense on your WordPress site, then having invalid clicks can lead to a lot of trouble and event get your account suspended. These are typically the result of clicks and impressions generated by bots or spammers.

At WPBeginner, we’ve helped thousands of users get started with AdSense and combat the issue of invalid clicks. A simple way to prevent AdSense clicks from bots and spammers is by using a plugin like Ad Invalid Click Protector (AICP).

In this article, we’ll show you how to prevent invalid AdSense clicks in WordPress so you can keep your account in good standing.

How to prevent invalid Adsense clicks in WordPress

Here’s an overview of the topics we will cover in this guide. You can click the links below to jump ahead to any section:

What are Invalid Adsense Clicks?

Invalid AdSense clicks are any clicks to your ads that occur from invalid traffic.

What Does Google Consider Invalid Traffic?

  • Clicks or impressions from website owners clicking their ads
  • Repeated ad clicks or impressions from one or more users
  • Website owners who are manipulating users to accidentally click their ads
  • Automated tools like bots and robots manipulate impressions and clicks

If you’re getting real people viewing and clicking your ads, then you’re fine.

However, sometimes you’ll have traffic coming to your WordPress website from low-quality sources. One form of this is bot traffic that clicks on display ads.

Does Google AdSense Detect Invalid Clicks?

Yes, Google has a very sophisticated platform that will automatically detect all invalid clicks.

Usually, Google will not take action against accounts unless high levels of invalid traffic and clicks have occurred.

Having small amounts of bot and crawler traffic, double ad clicks, and other errors are common, so they tend to ignore it.

However, Google will automatically adjust your account earnings to take out bot traffic and fake clicks. These adjustments happen both in real-time and at the end of the month.

The best way to avoid an account penalty is to stop invalid traffic from reaching your site in the first place. You can report invalid clicks to the Google Adsense team, but this doesn’t free your account from responsibility.

How to Protect AdSense from Invalid Clicks in WordPress

Invalid clicks are a threat to your WordPress blog and the ability to make money online, especially if it’s an ongoing problem.

There are three things you can do to help keep your Google AdSense account in good standing:

  • Monitor your traffic and identify any invalid sources
  • Make sure your ad placements are in alignment with AdSense guidelines
  • Use an AdSense protection WordPress plugin to block invalid traffic and clicks
  • Use Cloudflare and other WordPress security plugins to prevent DDoS traffic

Understand Your Ad Traffic and WordPress Visitors

The root problem of invalid AdSense clicks is your traffic.

As a WordPress website owner, you are responsible for the traffic your website receives. That’s why it’s extremely important to understand how people find and use your website.

The easiest way to monitor your website traffic and analytics is with MonsterInsights. It’s the best analytics solution for WordPress and is used by over 3 million website owners like you.

There’s also a free version of MonsterInsights that gives you access to your most important analytics data.

For more details, see our guide on how to install Google Analytics in WordPress.

Once you’ve set up the plugin, you can view your Google Analytics reports within your WordPress dashboard. Simply go to Insights » Reports to get a quick overview of your traffic.

MonsterInsights understand WordPress traffic

You can compare your Google Analytics and Google AdSense data to see if any traffic sources are the cause of invalid clicks.

Maybe you’ve found that a single low-quality referring website is sending spam traffic your way, or when you post in a certain Facebook group, the traffic back to your website is mostly bot traffic.

Avoid Accidental Visitor Clicks in WordPress

You could be getting invalid clicks from your visitors accidentally clicking on ads.

Suppose your ads are too similar to the rest of your content, or your ads are in positions that make your site hard to use. In that case, your visitors could be clicking on your ads by mistake.

For example, if you have an ad directly below a drop-down menu, this could cause visitors to click that ad on accident.

Another common mistake is using ad units that look like your content and navigation links. If a user clicks the ad, thinking they’re navigating around your website, this could lead to accidental clicks.

For more details on AdSense ad placement, see our step-by-step guide on how to optimize your AdSense revenue in WordPress.

Block Invalid Traffic Sources With a WordPress Plugin

If your ads are correctly set up, but you’re still getting a warning from Google, then you’ll want to block invalid traffic sources with a WordPress plugin.

To do this, we recommend using the Ad Invalid Click Protector (AICP) plugin. It’s highly customizable so that you can block traffic and users according to your needs.

With this plugin, you can block entire countries, set a maximum number of ad clicks per user, block visitors when they hit your ad limit, block IP addresses, and more.

The first thing you’ll need to do is install the Ad Invalid Click Protector (AICP) plugin. For more details on installing a plugin, see our step-by-step guide on how to install a WordPress plugin.

After the plugin is installed and activated, you’ll have a new navigation option in your WordPress dashboard called ‘AdSense Invalid Click Protector.’

Next, you’ll need to configure the plugin settings. To do this, navigate to Adsense Invalid Click Protector » General Settings.

AdSense invalid click protector settings

On this screen, you’ll set the conditions for the kind of behavior and traffic you want to block.

We’re going to set the ‘Ad Click Limit’ to 2, so a visitor can only click on an ad twice before it stops displaying.

Next, we’ll set the ‘Click Counter Cookie Expiration Time’ to 5 hours. This means that after 5 hours, your ads will display again for that user.

After that, we’ll leave the ‘Visitor Ban Duration’ at the default 7 days. This will stop your ads from being shown to banned visitors for 7 days.

AdSense invalid click protector change settings

To block ads from showing for specific countries, set the ‘Do you want to block showing ads for some specific countries?’ checkbox to ‘Yes.’ Or, leave it as ‘No’ if you don’t want to block specific countries.

Then, enter the country code for the country you want to block.

Make sure to click ‘Save Changes’ before exiting the screen.

AdSense invalid clicks plugin block country code

After you’ve set up your block settings, you’ll need to add the plugin code to your existing AdSense ad units.

Where you add the code depends on how you’ve added your Google AdSense code to WordPress.

If you manually added your AdSense code to WordPress, then you’ll need to locate every instance of the code across your site.

If you’re using a plugin to manage your ads, then navigate to the plugin and open up your AdSense code block. It’ll look similar to the code below.

AdSense code example

Once you’ve done that, you’ll need to add the following code before your AdSense ad code block:

if( aicp_can_see_ads() ) { /* Your AdSense code goes here */ }

Then, wrap your ad code in a simple div tag:

<div class="aicp">...your ad code goes here...</div>

Your final ad code will look something like this:

if( aicp_can_see_ads() ) { 
<div class="aicp">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- AdSense Responsive Ad Code -->
<ins class="adsbygoogle"
    style="display:block"
    data-ad-client="ca-pub-1234567890"
    data-ad-slot="0123456789"
    data-ad-format="auto">
</ins>
<script>
    (adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
}

A simple way to add code to your site is by using WPCode.

It is the best code snippet plugin for WordPress and lets you insert custom code without breaking your site.

Add a new custom snippet in WPCode

For more details, please see our guide on how to easily add custom code in WordPress.

After adding the plugin code to your Google AdSense ads, your ads will display based on the block settings you assigned earlier.

If you prefer a hands-off solution, then there is a premium plugin called WP Advanced Ads Pro that has click fraud protection built-in.

You can enable click fraud protection directly from the plugin settings. There is no additional code you need to add to your site.

We hope this article helped you prevent invalid AdSense clicks in WordPress. You may also want to see our collection of the best WordPress ad management plugins and solutions and how to properly move from Squarespace to WordPress.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

18 CommentsLeave a Reply

  1. Jiří Vaněk

    AdSense is my backup plan for monetizing the website. I was indeed concerned about ensuring everything is compliant with the rules, and I found the topic of securing ads very intriguing. Once I start running ads on the site, I will definitely secure them against accidental clicks to avoid getting banned by Google before receiving my first payment. Thanks for the interesting article and for bringing up this topic. I wouldn’t have thought of proactively addressing such issues.

  2. kzain

    As a blogger, I’ve been worried about the impact of accidental clicks on my account. Your step-by-step guide has given me the confidence to tackle this issue head-on. I’ve already implemented the click-tracking script and adjusted my ad placements to minimize errors. The tip on using a plugin like AdSanity to manage ads is also super helpful. Thanks for sharing your expertise and helping me protect my AdSense account

  3. Ahmed Omar

    Invalid clicks is nightmare, as it may affect or in worst cases can block the adsense account
    Thank you for theses information which is really important to consider
    I will use this plugin and give it a try
    Thank you

    • WPBeginner Support

      You’re welcome, we hope you find the plugin helpful!

      Admin

  4. Shahid Hussain

    I think this plugin not working on mobile devices

    • WPBeginner Support

      Correct, for the moment the plugin author says that this is due to how touchscreens work instead of mouse click input.

      Admin

  5. Arsl

    My adsense has auto ads code and i have added in the header.php file of my wordpress script so what do i need to do to make this plugin work?

    • WPBeginner Support

      The plugin does not currently work with auto ads, you would need to check with the plugin’s support for their plans on adding support for auto ads.

      Admin

  6. Diekola Yusuf

    I followed all steps in this guide, but I always see the

    if( aicp_can_see_ads() ) {

    The ads displays correctly
    }

    on the frontend of my website

    • WPBeginner Support

      That method is for if you are using a plugin to add the code, you would not need the if statement when manually editing the code in your site’s content.

      Admin

  7. Abugnaba stephen

    please is it a must to to add the plugin code to my existing AdSense ad units, before Ads invalid click protector can work?

    • WPBeginner Support

      Yes, you must add the code to your ads for the plugin to work.

      Admin

  8. Inayat

    Really thankful to you! I’m searching for this post on your site. I want to know what you suggest at the beginning level doing this setting is a good thing or waiting till the minimum traffic we get.

    • WPBeginner Support

      It is fine to do this in either circumstance if you are wanting to help prevent invalid clicks.

      Admin

  9. Awais Afzal

    Hi, Thank you so much for the plugin recommendation. There is a question in my mind. Normally there is an Auto Ad Option We got Google Adsense Which means we are only required to put the code in the head section which verifies the google Adsense with our Wordpress website and don’t need to add code manually on different sections. Now how will we block invalid clicks on our website with this plugin if we use aut ad option?

    • WPBeginner Support

      The plugin does not currently support auto ads, you would want to reach out to the plugin’s support for any timelines on ability to work with Auto Ads

      Admin

  10. Francis

    Is there a way I can apply this to my auto ads?

    • WPBeginner Support

      You would need to check with the plugin’s support for their current availability to handle auto ads

      Admin

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.