Learn Something New Everyday. WebCoderHub - HouSe oF coDers is all About blogging tutorials, Youtube Tricks, SEO Tricks, and Technical Tips & Tricks. In WebCoderHub we Provide HTML, CSS, and JS with Us Free to use. Best Free & Premium Blogger and WordPress Tutorials For You. Find a perfect template Tutorial with SEO Optimized and improve your blog right now. A Better Way To Learn.
How to Install Anti Adblock Script In Blogger like median ui
Best way to Install Anti Adblock Script In Blogger
Hello Friends, Welcome back to WebCoderHub. Today on this occasion I am going to explain how you can add Anti AdBlocker to your Blogger Website.
What is an AdBlocker?
AdBlocker is somewhat a type of script or program that stops the Ads to load on the websites. The user uses AdBlocker so that Ads do not load on the website and internet consumption reduces that so websites loads faster.
How do AdBlockers affect the website owners?
When a user uses an AdBlocker in the browser to stop the ads to load then it decreases the earnings of website owners. If the website had put ads on his website for his earnings and the user uses adblocker then the ads will not load and the website owner will not get the impressions and clicks on the ads.
This is very painful when a creator does so much hard work to provide content to his users and in return, he does not get anything in return.
That's why website owners use Anti AdBlocker on their website so that users do use Adblockers on their website and kill their earnings.
If you use Adsense on your blog, you already know that it pays you for ad impressions and clicks. If a person uses an adblocker chrome extension, those ads will be prevented from loading on that page. As a result, no ads will be displayed to users, and you will not profit from their visits.
How do Anti AdBlocker works?
Anti Adblocker is a type of script which is put on the website to stop the AdBlocker present in the browser. Anti AdBlocker gets activated when the script finds that AdBlocker is present in the browser.
Anti AdBlocker does not allow the user to access the content present on the website until the user turns off the AdBlocker.
Features of Anti Adblocker Script are
No Content Shifting Problem
Easy to use
Will maximize your earnings very much
No Jquery used
Made with Pure HTML, CSS, JavaScript
Stops most of the Adblocker extensions and Scripts
Interrupts the view of the user with a simple popup
How to add Anti Adblocker Script in Blogger website?
Let's see how you can add Anti AdBlocker Script in Blogger website. The Best way to Install Anti Adblock Script In Blogger is to follow the given below steps and do it.
Scroll down to the bottom and getthe codes for Anti AdBlocker Script
Instructions to implement the code are given in the downloaded file.
Go to Blogger Dashboard
Then go to Theme > Edit HTML
And Follow the instructions in the file.
Get the Codes for Anti AdBlocker script in Blogger Website.
Credit for this Anti AdBlocker script goes to Fineshop Design.
Important!Before we start adding codes in XML, I will recommend you to take a Backup of your current theme. By chance if any problem occurs, you can restore it later.
Step 6: Now add the following Javascript just above to </body> tag. If you don't find it, it is probably already parsed which is </body>.
<script>/*<![CDATA[*//**
* Anti Ad Blocker Code by Fineshop Design
* Last Updated: 15:22 16/02/2023 IST
* Copyright: https://www.fineshopdesign.com
*/
(function(key){const data={allowed:null},url="https://cdn.jsdelivr.net/gh/fineshop/plus-ui@2.7/main/ads/adsbygoogle.js";this[key]=function(callback){if("function"!=typeof callback)return;const called=[];functiononeTimeCallback(){0===called.length&&(called.push(1),callback(data))}if("boolean"!=typeof data.allowed){let xhr=null;try{xhr=new XMLHttpRequest}catch(e){try{xhr=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xhr=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return}}}xhr.onreadystatechange=function(){if(xhr.readyState===xhr.DONE){if(xhr.status>=200&&xhr.status<=299){const fakeAd=document.createElement("div");fakeAd.className="textads banner-ads banner_ads ad-unit ad-zone ad-space adsbox ads",fakeAd.style="height: 1px; width: 0; opacity: 0; visibility: hidden; position: fixed; bottom: 0",document.body.appendChild(fakeAd),data.allowed=0!==fakeAd.offsetHeight,fakeAd.remove()}else data.allowed=!1;oneTimeCallback()}},xhr.onerror=function(){data.allowed=!1,oneTimeCallback()},xhr.open("GET",url),xhr.send("")}else oneTimeCallback()}}).call(this,"checkAdsStatus");
functionantiAdBlockerHandler() {
window.checkAdsStatus(function(ads) {
if (!ads.allowed) {
// Ads are Blockedconsole.log("%c[ADS]", "color:#d32f2f;", "Blocked");
const icon = "<svg style='stroke:none;fill:currentColor!important' viewBox='0 0 24 24'><path d='M12.2 9L10.2 7H13C14.1 7 15 7.9 15 9V11.8L13 9.8V9H12.2M23 9V7H19C17.9 7 17 7.9 17 9V11C17 12.1 17.9 13 19 13H21V15H18.2L20.2 17H21C22.1 17 23 16.1 23 15V13C23 11.9 22.1 11 21 11H19V9H23M22.1 21.5L20.8 22.8L14.4 16.4C14.1 16.7 13.6 17 13 17H9V10.9L7 8.9V17H5V13H3V17H1V9C1 7.9 1.9 7 3 7H5.1L1.1 3L2.4 1.7L22.1 21.5M5 9H3V11H5V9M13 14.9L11 12.9V15H13V14.9Z'/></svg>";
const title = "Ad blocker detected!";
const message = "<p>We have detected that you are using adblocking plugin in your browser.<br/>The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.</p>";
// Lets create the popupconst element = document.createElement("div");
element.className = "popSc";
element.innerHTML = "<div class='popBo'>" + icon + "<h2>" + title + "</h2><div class='popCo'>" + message + "</div></div>"document.body.appendChild(element);
} else {
// Ads are allowed;console.log("%c[ADS]", "color:#43a047;", "Allowed");
}
});
document.removeEventListener("DOMContentLoaded", antiAdBlockerHandler);
};
if (document.readyState === "complete" || document.readyState !== "loading") {
antiAdBlockerHandler();
} else {
document.addEventListener("DOMContentLoaded", antiAdBlockerHandler);
}
/*]]>*/</script>
Step 7: Lastly, Save the changes.
That's done!
Conclusion
This is all about adding the Anti AdBlocker to Blogger Website. I hope you like this Tutorial. Please do share this article. And if you are facing problem in any section or you have any question then ask us in comment box. Thank you!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser. The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.