Adblock detection tool
Overview
If you want to be able to detect when your clients have their ad blocker enabled, you can copy the code below to your project. This code will detect when one of your clients has their ad blocker enabled, and it will allow you to decide what to do after detection. The code below should be inserted in your page's <body>
.
<script type="text/javascript">
let isAdblockEnabled = false;
var elem = document.createElement("div");
document.cookie =
"_adblock=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
document.cookie =
"_scriptblock=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/";
elem.style.position = "absolute";
elem.style.top = "-10000px";
elem.style.left = "-10000px";
let arr = ["adclass","adbox","sidebar_newsletter_sign_up","sidebar_subscribe","sign-up-form-single","signup-form--header","signup-with-checkboxes","skinny-sign-up","slidedown-newsletter","small-newsletter","social-link-mail","social_newsletter_box","story-follow-module","subscrOptWide","subscribe-article-bottom","subscribe-banner","subscribe-block","subscribe-blurb","subscribe-newsl","subscribe-right","subscribe-to-magazine","subscribe2","subscribeModal","subscribetitle","subscribe_box","subscribe_btn","subscribe_cont","subscribe_email","subscribe_form","subscribe_link","subscribe_popup1","subscribe_thasu","subscribe_to_im","subscribe_webopedia_weekly","subscribeform","subscription-box-cntr","subscription-form-container","subscriptionForm","subwidget","tl-newsletter-widget","traqli-subscribe","tsq_sailthru_newsletter_widget","ui-home-newsletter","ui-newsletter","ui-newsletter-channel-sign-up","ui-newsticker-wrapper","widget-newsletter","widget-ngs-subscribe","widget-subscribe","widget_cbs_newsletter_widget","widget_ione-bp_newsletter_signup","widget_mailerlite_widget","widget_mymail_signup","widget_newsletter","widget_newsletter_sidebar","widget_newsletter_signup","widget_newsletters","widget_newsletterwidget","widget_ns_mailchimp","widget_ok_mailinglistmultiple_widget","widget_signupwidget","widget_subscribe","widget_subscribe-form","widget_subscribe_box","widget_text_newsletter","widget_woo_customsubscribewidget","widget_woo_subscribe","BackToTop","TopGoTop","axScrollToTop","back-to-top","back-to-top-link","back-to-top-wrap","backToTop","backTopLink","back_to_top","backtopbutton","backtotop","block_to_top","btn-back-to-top","btn-go-top","btn-return-top","header_ad","header_ad_center","header_ads","header_advert","headerad","headerads","home-ad","home-ads","homeAd","homead","homepage-ad","homepage_ads","horizontal_ad","html-advertisement","image-advertisement","img_ad","imgad","inner_ad","innerad","interstitial_ad_wrapper","ipsAd","item-ads","item-container-ad","leaderboard-ad","leaderboard-ads","leftAd","leftad","ligatus","list-ad","list-ads","listad","logo-ad","marketing-ad","mid_ad","middle_AD","mod-adopenx","module-ad","newsAd","oasad","openx","page-ad","page_ad","pfAd","player_ad","player_hover_ad","pm-ad","post-ad","post-sponsored","post_ad","postad","premiumAdOverlay","premiumAdOverlayClose","promoAd","pub_300x250","pub_300x250m","pub_728x90","pushdown-ad","rail-ad","rbRectAd","rectangle_ad","refreshAds","region-top-ad-position","reklam","reklama","reportAdLink","resultad","right-ad","rightAd","right_ad","right_ads_column","rightad","rightadv","searchAds","searchad","searchads","showAd","side-ad","side-bar-ad-position1","single-ad","singleAd","skinAd","sky_ad","skyscraperAd","slide-ad","smallAd","small_ad","smallads","sponsor-box","sponsorBlock","sponsorBottom","sponsoredLinks","sponsorlink","sticky-ad","story-ad","text-ad","text-ad-links","text-ads","textAd","text_ad","text_ads","textad","textads","top-ad","top-ad-wrapper","topAds","top_ad","top_ad_div","top_ad_wrap","top_ads","topads","tower-ad","type_ads_default","view_ad","wideAd","withAds","wnad","wpInsertInPostAd","yom-ad","adbanner600active","nipnadszone","pub300","pub_left","pub_pave","pub_vertical","publicite","publicite_gauche","publicity","top-publicite","addthis_default_style","feed-icon","feedback-button","icon-rss","rss-feed","rss-widget","rssicon","rssFeed","scribol","sharrre","taboola-inbetweener","OUTBRAIN","outbrain","newsletter-popup","signup-email","subscription-box","Cookies","cookie-notice","cookie-notification","cookie-policy","cookie-warn","cookieBar","cookie_policy","cookiebanner","cookies-info","no-cookies","top-of-page","FollowButton","addthis_32x32_style","addthis_toolbox","addthisbuttons","advanced-social-widget","arqam-widget-counter","article-share","article_share","block-socialmedia","btn-facebook","btn-fb","btn-google-plus","btn-gplus","btn-instagram","btn-linkedin","btn-share","btn-twitter","btnFacebook","btnTwitter","btn_fb","button-pinterest","button-share","comment_share","connect_widget","custom-sharing-link","custom-social","digg-button","digg_button","embed-twitter","fa-facebook","fa-facebook-square","fa-google-plus","fa-share-alt","fa-twitter","fa-youtube-play","facebook-btn","facebook-button","facebook-container","facebook-widget","facebookicon","facebookBtn","facebookLikeBox","facebook_button","facebookbutton","fb-box","fb-btn","fb-button","fb-like","fb-likebox","fb-link","fb-recommendations","fb-recommendations-bar","fb-share-box","fbBox","fbContainer","fb_box","fb_btn","fb_button_large","fb_edge_widget_with_comment","fb_like_container","fb_share","fblike","follow-bar","follow-btn","follow-button","follow-label","follow-widget","followBox","follow_box","follow_btn","follow_twitter","footer-social","g-plus","g-plusone","google-btn","google-plus","google_plus","group_share","icon-facebook","icon-facebook2","icon-fb","icon-google-plus","icon-google-plus-sign","icon-googleplus","icon-gplus","icon-instagram","icon-share","icon-social-facebook","icon-social-linkedin","icon-soundcloud","icon-twitter","icon_gplus","img-share","instagram-follow","itemSocialSharing","j-social-actions","j-social-button","linkedinicon","list-share","m-article__share-buttons","mod-socialmedia","photo-share","pin-it-button","pinButton","pinit-overlay","pinit_btn","pinterest-button","pinterest-share-button","pinterest1","pinterestComponentShare","plusone","post-fb","post-fb-like","post-social","post_share","reddit_button","retweet","share-bar","share-box","share-btn","share-button","share-buttons","share-container","share-facebook","share-head","share-header","share-icon","share-item","share-link","share-menu","share-options","share-panel","share-popup","share-section","share-title","share-twitter","share-widget","share-with-friends","share-wrap","share-wrapper","shareContainer","shareCount","shareLeft","shareLink","shareLinks","sharePanel","shareText","shareTools","shareToolsItem","share_bar","share_bottom","share_container","share_panel","share_tools","share_wrapper","sharebox","sharebutton","sharebuttons","sharecontainer","sharethis-wrapper","sharetools","sharing-buttons","show-share","show_social","social-bar","social-block","social-bottom","social-box","social-btn","social-button","social-buttons","social-count","social-counter","social-facebook","social-google","social-gplus","social-header","social-icon","social-icons","social-link","social-links","social-media","social-media-buttons","social-post","social-sharing","social-sidebar","social-tab","social-top","social-twitter","social-wrap","social-wrapper","socialBlock","socialBox","socialButtons","socialIcon","socialList","socialMedia","social_bar","social_buttons","social_container","social_links_top","social_row","social_share","social_toolbar","socialbar","socialbox","socialboxp","socialbuttons","socialmedia","socials","socialshare","stumble-button","subscribe-widget","tweet-btn","tweets","twitter-button","twitter-hashtag","twitter-share","twitter-share-button","twitter-icon","twitterShare","twitterWrapper","twtr-widget","ui-share-component","vertical-social","wrapper-share","x-facebook","youtube_subscribe_module"]
for (let i = 0; i <= arr.length; i++) {
elem.classList.add(arr[i]);
}
document.body.appendChild(elem);
window.setTimeout(function () {
var isAdblockEnabledd = !(
elem.offsetWidth ||
elem.offsetHeight ||
elem.getClientRects().length
);
if (isAdblockEnabledd) {
isAdblockEnabled = true;
} else {
isAdblockEnabled = false;
}
elem.remove();
var d = new Date();
d.setTime(d.getTime() + 60 * 5 * 1000);
document.cookie =
"_adblock=" +
isAdblockEnabled +
"; expires=" +
d.toUTCString() +
"; path=/";
let a = window.tonos ? false : true;
if (isAdblockEnabled) {
if (a) {
((src) => {
let el = document.createElement("script");
el.src = src;
el.type = "text/javascript";
el.async = !0;
el.onerror = () => {
document.cookie =
"_scriptblock=" +
true +
"; expires=" +
d.toUTCString() +
"; path=/";
};
el.onload = () => {
document.cookie =
"_scriptblock=" +
false +
"; expires=" +
d.toUTCString() +
"; path=/";
};
let p = document.getElementsByTagName("script")[0];
p.parentNode.insertBefore(el, p);
})(
"https://client.tonos.gjirafa.tech/tonos-script-dev.js?aId=**ID**&t=web"
);
} else {
document.cookie =
"_scriptblock=" +
false +
"; expires=" +
d.toUTCString() +
"; path=/";
}
} else if (!a) {
document.cookie =
"_scriptblock=" +
false +
"; expires=" +
d.toUTCString() +
"; path=/";
}
}, 500);
</script>
NOTE
In the adblock script, make sure to change the ID section (abcd
) to your own application's ID.
ADDITIONAL INFO
If you want to make your adblock script unreadable by other people, you can choose to obfuscate it in any online obfuscator tool. Make sure to remove the <script>
tags when inserting the adblock script in these obfuscators.