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)

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Do you want to learn how to prevent invalid AdSense clicks in WordPress?

Invalid AdSense clicks are the result of clicks and impressions that are typically generated by bots or spammers. A high number of invalid clicks can get your AdSense account suspended.

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

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:

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 AdSense Invalid Click Protector 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 AdSense Invalid Click Protector 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>
}

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 our expert pick of 24 must have WordPress plugins for businesses.

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

17 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Ahmed Omar says

    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 says

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

      Admin

  3. Arsl says

    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 says

      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

  4. Diekola Yusuf says

    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 says

      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

  5. Abugnaba stephen says

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

  6. Inayat says

    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 says

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

      Admin

  7. Awais Afzal says

    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 says

      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

    • WPBeginner Support says

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

      Admin

Leave a Reply to WPBeginner Support Cancel 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.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.