Script code to disable Anti AdBlock on Blogger blogs
A large number of Internet surfers use the AdBlock script, which blocks the appearance of ads, which causes great harm to publishers and content creators. Therefore, in this article, we will explain to you how to install the AdBlock script for Blogger blogs in order to protect AdSense profits and solve the problem of low return on visits.
What is AdBlock?
An ad blocker is an add-on installed on an Internet browser such as Google Chrome and Firefox that blocks the appearance of ads and pop-up windows before loading them. AdBlock blocks any advertising network and prevents it from becoming visible to the user.
Why do visitors prefer using AdBlock?
Most users prefer to install a tool to block ads from appearing because it is an annoyance for them. Many times we come across sites that contain a lot of annoying ads popping up everywhere that make the browsing experience bad and block the view of the textual content on the page.
It's nice for readers to have a blank page free of ads. However, for content creators, this addition causes a lot of trouble and a decrease in income, which is why any publisher on the web is looking for an ad blocker code on Blogger to force visitors to include your site in the white list of sites allowed to display ads.
How does an ad blocker affect profits?
You must ensure the importance of installing the AdBlock detector script on the blog, whether you are using Blogger or WordPress, because the AdBlock Killer tool is the safety valve that will keep you working and publishing and will also help you improve your profits so that you can save and pay for hosting and domain costs.
If the ads are blocked by the visitor via AdBlock, AdSense ads will not appear on your site and therefore there will be no clicks and you will not receive any revenue for your work, so I recommend you use the Anti AdBlock detector code on Blogger to increase profits.
How to install the Ad Blocker script on Blogger
After we have explained the importance of ad blocking for bloggers, websites, and forums, we will now explain how to install the AdBlock Detector script on a Blogger blog.
Follow the following steps to install the script to add the ad blocker script to Blogger.
Note: Do not forget to take a backup copy of the template to restore it later in case problems arise.
Step 1: Open Blogger control panel.
Step 2: Go to Themes and press the down arrow 👇 The HTML has been modified.
Step 3: Add the following JavaScript code above a tag </body>
at the end of the template codes.
<script>
//<![CDATA[
!(function () {
function f() {
var a = document.getElementById("postBody");
a.innerHTML =
'<p class="note noteAlert blocked"><strong>AdBlock Detected:((</strong><br /><br />Sorry, we have detected that you are using an ad blocker, Ad-Blocker. <br /><br />Please include our site in the whitelist of sites allowed to display Ads, this will help us maintain the site. <br>To view the content disable the ad blocker and refresh the page.<br /><br />Thank you!!!</p>';
}
var b = document.createElement("script");
b.type = "text/javascript";
b.async = !0;
b.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
b.onerror = function () {
f();
window.adblock = !0;
};
var e = document.getElementsByTagName("script")[0];
e.parentNode.insertBefore(b, e);
})();
//]]>
</script>
In most templates, the topic identifier is postBody
but on some Blogger templates it can be in this form: post-body
or post-wrapper
Make sure to change the place that we marked in green in the JavaScript code (search for the three phrases until you find which one is used in your template Exactly) in case the Blogger ad blocking detector script does not work for you.
Step 4: Add CSS code to customize the appearance of the ad blocker notification message </head>
directly above the tag.
<style> article .note{position:relative;padding:20px 30px 20px 50px;background-color:#e1f5fe;color:#01579b;font-size:.85rem;line-height:1.62em;border-radius:2px} article .note:before{content:'\2605';position:absolute;left:18px;font-size:20px} article .noteAlert{background-color:#ffdfdf;color:#e65151} article .noteAlert:before{content:'\2691'} </style>
Now, after going to the blog and opening any article when the ad blocker is turned on, you will notice that the Anti AdBlock script and detection code will automatically hide the entire text content and a notification will appear in its place asking the visitor to disable Adblocking in order for the topic to appear.
Blogger's Ad Blocker code will require the visitor to disable AdBlock before he can reload the page again and access the contents of the article.
The ad blocker detector script will definitely benefit you, and will prevent your site visitors from using the AdBlock add-on, so we invite you to view more wonderful Blogger add-ons on our website.