We all want to earn a few bucks from our blogs as a side hustle but we can’t because of this evil AdBlockers. We are not against AdBlockers in general, we think AdBlockers are great tools for sites where admins just bombard visitors with popups and flying ads on the screen. But for good sites that want to earn some income by showing few ads on the page without spoiling the user experience shouldn’t be targeted by AdBlockers.
This is a very simple goal to achieve and we don’t need a WordPress plugin for this either. All AdBlockers works in the same manner, either they remove the ad after it loads up or block the request by page to the Ad Engine like Google Adsense.
We assume that you have basic experience with JavaScript. Don’t worry we will not tell you to write any code but we need that you know where to paste the code. This could apply to Non-WordPress websites too because the script has no hard logic for WordPress websites only. The only thing that matters is that the script should be in the page where you want to show ads and doesn’t want to let them blocked by AdBlockers.
Simple Way To Block AdBlocker For WordPress Without Plugin
Step 1: Find WordPress Theme options where you can insert a script before tag that will be applied to your targeted page where you want to show Ads.
Step 2: Paste this code block there.
The code mentioned above will:
- Wait for 2 seconds to let the page load and allow the AdBlocker (if installed) to remove the Ads on the page. Then it checks for an element in the page with a tag
ins.adsbygoogle
that usually contains Google Ads (Please update it if you are using different ads). - It alerts the visitor with this message
Please don't use an Ad blocker on this site.
- Creates one image element with
http://techmuzz.com/wp-content/uploads/2018/12/stop-ad-blockers.png
as source (Please use a different image that you would like to show to the visitor) . - Find all the
article
elements in the page, append image that it just created to its parent element and then remove article elements one by one so user can’t use any tricks to skip these steps and see the content by anyway.
Step 3: That’s it.
Please let us know if you face any problems while implementing the steps mentioned above. We will be glad to help you.
Thank you & Stay Techie…