Fool proofing your site’s Google ads in WP (Part 1)

Fool proofing your site's Google ads in WP

Google AdSense is an advertising program that allows website owners to display other people’s advertising (ads) on their websites. It is a nice platform for website owners to generate extra revenue from their content.

This is an ongoing post. Please suggest corrections, explanations, etc. in the comment section at the bottom of this page.

Because ads can sometimes be a bit annoying for internet content browsers (users, )there are many, so-called, ad blocker plugins available today. When activated on a web browser, these plugins basically stop ads from being displayed on a website. This does not only mean obvious revenue loss for your hard work, but can also leave ugly spaces in your web layout.

Fool proofing your site’s Google Ads in WP is a two-part guide on how to reduce the effects of ad blockers. In the first part we will encourage website users to disable their ad blocking software. Part two will show how to set up a backup ad for when Google Ads does not have an ad to show.

This post (part one) will guide you through creating a basic page explaining your website’s ad policy and tell the visitor why it’s not so bad to see your ads. Then we are going to install a WordPress plugin to distinguish whether the visitor is browsing with, or without an ad blocker. If an Ad blocker is installed, the user will see a link to your ads policy, and if no ad blocker is installed the user will see the AdSense ad.

If you are using an
Ad Blocking Browser Extension please consider deactivating it for this website.
Also see our Ads Policy.

What you’ll need (part 1)

With this post it is assumed that Google AdSense ads are already up and running on your website – meaning that you are fairly clued up with basic web languagesWordPress plugins, layout and probably Widgets.

Generally, Google AdSense snippets are added to a website as PHP, either into a plugin that creates a shortcode, or directly into the PHP code. Also see the using shortcodes in WordPress like a boss post for more information.

The following free WordPress plugins need to be installed and activated:

To test your progress, an AdBlocker browser extension needs to be installed on your testing web browser. A good, easy one to use is Adguard AdBlocker, which can activated/deactivated per site with the click of a button:

Creating the website’s ads policy page

In WordPress, create a page explaining the website’s ads policy. Here is the Behind the Scenes’ ads policy. Use your own wording, but be polite, constructive and diplomatic. Remember that you are trying to persuade the website user to actively deactivate their ad blocker.

I recommend to at least say something about Google’s reputation and their policies, the content of the ads, the amount of ads per page and their positioning. Google’s policies place emphasis on abuse, proper/relevant content, amount of ads per page and the display of ads, etc.- making them a good choice for legit, decent websites.

Don’t even try doing pop-ups, because the only thing more annoying than ads are pop-up ads.

Ad Blocking Detector

Ad Blocking Detector plugin

The Ad Blocking Detector plugin simply detects whether an Ad Blocking browser extension is being used on a web browser and if it is, gives the opportunity to display alternative code. Alternative code can, for example, be a non-ad coded notice, an image, a link, etc. This will be done in the form of creating a shortcode – which can then be used either in the composing area or as PHP code to incorporate into the website.

Go back to the main plugin settings (available from Ad Blocking in the WordPress Admin menu) then choose Add New Shortcode. This will give you space for your original AdSense ad (‘No Ad Blocker Detected Content’) and for ‘Ad Blocker Detected Content’.

Here is some example html code to put in the ‘Ad Blocker Detected Content’:

<div class="adspolicy" style="height:auto; background-color:#ff0000; padding: 15px; font-size: 1.5em; color: #ffffff;">
If you are using an<br><b>Ad Blocking Browser Extension</b> please consider <b>deactivating</b> it for this website.<br>
<span style="font-size: 0.8em;">Also see our <a href="" title="Behind The Scenes' Ads Policy">Ads Policy</a>.</span>

which will look like:

If you are using an
Ad Blocking Browser Extension please consider deactivating it for this website.
Also see our Ads Policy.


Any alternative code can be added to this section. I use the above code with Responsive ads so that it can auto resize.

Add your AdSense ad code to Ad Blocking Detector’s ‘No Ad Blocker Detected Content’, add the shortcode to where you want the ad to show and activate your “preferred” Ad Blocking browser extension. You should now see your custom message.


With this part of Fool Proofing Your Site’s Google Ads in WP we created a basic page explaining your website’s ad policies to tell your website users why it’s not so bad to disable their Ad blockers.

In part two of Fool Proofing Your Site’s Google Ads in WP we will be looking at creating alternative ads when Google AdSense does not have targeted ads to show on a page.

About the author
Renier busies himself with improving his English writing, creative web design and his websites, photoshopping, micro-electronics, multiple genres of music, superhero movies and badass series.

Save, share & Disqus

Use the buttons below, on the left or the bottom of this page to share this post. Your comment is important, but don't be a shit. Keep it constructive and polite.

Comment via Disqus

Disqus is a worldwide comment hosting service for web sites and online communities. This secure platform ensures a pleasant commenting environment which is manageable from one account. Use the Login button to sign up.

More website development related posts

Try one of’s online software and skills learning courses
Try one of’s online software and skills learning courses
21 February 2019
Ad: Improve your knowledge on anything from programming to business skills with’s huge range of professional video courses. More…
Using the Media Library Assistant plugin for WP
Using the Media Library Assistant plugin for WP
5 January 2019
WordPress websites with a large amount of Media content can become overwhelming to manage. With expanding libraries, images and other media can start to disappear in a sea of files which can make finding them very difficult. With the Media Library Assistant plugin for WordPress, searching and organising Media files becomes a breeze. More…
Website Development
Disabling the Gutenberg Editor in WordPress 5
Disabling the Gutenberg Editor in WordPress 5
9 December 2018
Most WordPress users are probably happy with regular updates on their favourite content management website software, but for me, a striking difference starting at WordPress 5 was the Gutenberg Editor instead of the, now, Classic Editor. Without going into to much of a discussion, this post will show how disable the Gutenberg Editor. More…
Website Development
Creating custom social media share buttons for posts
Creating custom social media share buttons for posts
27 October 2017 | Updated 12 December 2018
Website developers might find it necessary to have custom social share buttons at the top/bottom of their web pages. Custom buttons, as suppose to the regular/default buttons, allows better integration with the rest of a website’s styling and create a more unique look and feel. More…