{"id":99724,"date":"2020-02-12T11:34:35","date_gmt":"2020-02-12T17:34:35","guid":{"rendered":"https:\/\/wpengine.com\/?post_type=resource&#038;p=99724"},"modified":"2022-02-01T20:27:19","modified_gmt":"2022-02-02T02:27:19","slug":"detect-adblock-wordpress","status":"publish","type":"resource","link":"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/","title":{"rendered":"Detecting Adblock Users On Your WordPress Site"},"content":{"rendered":"\n<p>It&#8217;s understandable that some internet users might want to tone down the number of ads on certain websites. After all, it\u2019s a plus that visitors want to focus on your content over promotional messages. However, as a blogger, you might be losing revenue because of this.&nbsp;<\/p>\n\n\n\n<p>Fortunately, there are several ways to work around ad-blocking software. This may give you a better chance of maintaining your revenue streams, and you can continue to focus on generating engaging content.<\/p>\n\n\n\n<p>In this post, we\u2019ll provide you with an understanding of how AdBlock software works. We\u2019ll also share some tips on how to detect whether someone is using it and what you can do about it. Let\u2019s dive in!&nbsp;<\/p>\n\n\n\n\n\n<h2 class=\"wp-block-heading\">How Does AdBlock Work?<\/h2>\n\n\n\n<p>Most <a href=\"https:\/\/help.getadblock.com\/support\/solutions\/articles\/6000087914-how-does-adblock-work-\">ad-blocking software<\/a> is designed around filters. Essentially, when someone using this type of tool visits your website, it scans the information returned from your server. If it finds anything that matches an item on its list of content to filter out, then that element won\u2019t be displayed.<\/p>\n\n\n\n<p>AdBlock is a valuable tool for many web users and is often added as a browser extension. For example, it can be helpful for those who do a lot of online research. Not only can it enable webpages to load faster, but it can also conserve bandwidth and battery life.&nbsp;<\/p>\n\n\n\n<p>However, there are some downsides to this trend for content creators as well as brands who pay you to promote their products. In 2019, over 25 percent of all internet users <a href=\"https:\/\/www.statista.com\/statistics\/804008\/ad-blocking-reach-usage-us\/\">had ad-blocking software<\/a>. The financial impact of this is fairly significant.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Additionally, ad-blocking software could be removing Call-to-Action (CTA) boxes, images, or buttons on your pages. If the tool detects any of these elements by filtering file names or keywords related to advertising, then they can be targeted even though they\u2019re not true promotions.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Detect AdBlock with Javascript<\/h2>\n\n\n\n<p>Fortunately, you can often counteract the loss of revenue to software such as <a href=\"https:\/\/adblockplus.org\/\">AdBlock<\/a>. For example, there are several ways to detect its use with WordPress, including adding some <a href=\"https:\/\/www.javascript.com\/\">Javascript<\/a> to your site. It\u2019s worth noting this method takes some coding know-how. We\u2019ll cover alternative solutions later.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Create a Javascript File<\/h3>\n\n\n\n<p>One way to detect AdBlock users on your WordPress website is to create and reference a JavaScript file called <em>adframe.js<\/em>. The software will read this as a promotion and attempt to filter it out, which will then trigger a message for your users that they aren\u2019t seeing all your content.&nbsp;<\/p>\n\n\n\n<p>First, create a file called <em>adframe.js<\/em> and add the following line of code:<\/p>\n\n\n\n<p><code>var adblock = false;<\/code><\/p>\n\n\n\n<p>Then save the file to your server using a File Transfer Protocol (FTP) client such as <a href=\"https:\/\/filezilla-project.org\/\">FileZilla<\/a>. Its name will make AdBlock attempt to prevent <em>adframe.js<\/em> from loading, and the next step below will enable you to alert visitors to this.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Modify Your <em>header.php<\/em> File<\/h3>\n\n\n\n<p>Next, you\u2019ll need to reference the JavaScript file you created in your site\u2019s header to send the message informing AdBlock users they\u2019re missing out on your content. This requires inserting some code to your <a href=\"https:\/\/wpengine.com\/resources\/wordpress-header-and-footer-code\/\">theme\u2019s <em>header.php<\/em> file<\/a>. We recommend using a <a href=\"https:\/\/wpengine.com\/resources\/create-child-theme-wordpress\/\">child theme<\/a> to avoid losing your changes during updates.<\/p>\n\n\n\n<p>You can make the necessary modifications with an FTP client and your favorite code editor, or in your WordPress dashboard by navigating to <em>Appearance <\/em>&gt;<em> Theme Editor:&nbsp;<\/em><\/p>\n\n\n\n<p>From here you can access the files for your active theme. You\u2019ll find <em>Theme Header<\/em> on the right side of the editor:&nbsp;<\/p>\n\n\n\n<p>Click on it, then add <a href=\"http:\/\/talkerscode.com\/webtricks\/detect-adblocker-using-javascript.php\">the following scripts<\/a> within the &lt;head&gt;&lt;\/head&gt; tags:<\/p>\n\n\n\n<p><code>&lt;script type=\"text\/javascript\"&gt;<br>&nbsp;var adblock = true;<br>&lt;\/script&gt;<br>&lt;script type=\"text\/javascript\" src=\"adframe.js\"&gt;&lt;\/script&gt;<br>&lt;script type=\"text\/javascript\"&gt;<br>if(adblock)&nbsp;<br>{<br>&nbsp;alert(\"Please Disable AdBlocker To View The Page\");<br>&nbsp;document.getElementById(\"wrapper\").style.display=\"none\";<br>}<br>&lt;\/script&gt;<\/code><\/p>\n\n\n\n<p>You can craft your own text for the message by replacing \u201cPlease Disable AdBlocker To View The Page\u201d with a custom notification.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Hide Content From AdBlock Users&nbsp;<\/h3>\n\n\n\n<p>It\u2019s really up to you whether you want to completely hide all your content from anyone using AdBlock. There is a bit of a debate regarding this approach. Some argue that if you employ conscientious advertising methods, you shouldn\u2019t need to worry about this type of software.&nbsp;<\/p>\n\n\n\n<p>It\u2019s important to remember that forcing someone to turn AdBlock off in order to view your content does not always work in your favor. The user is just as likely to abandon your site, rather than disable the extension. We recommend investigating <a href=\"https:\/\/wpengine.com\/resources\/monetize-wordpress-blog\/\">other monetization options<\/a> if you\u2019re not sure about hiding your pages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">AdBlock Detector Plugins<\/h2>\n\n\n\n<p>If dealing with AdBlock manually is not your cup of tea, there are also a few WordPress plugins available for handling this task. It\u2019s worth noting that there are only a few we recommend, as many created for this purpose have not been updated recently.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <a href=\"https:\/\/wordpress.org\/plugins\/adblock-notify-by-bweb\/\">Ad Blocker Notify Lite<\/a><\/h3>\n\n\n\n<p>Ad Blocker Notify Lite provides an easy-to-use detection interface for your website. While it doesn\u2019t prevent users from accessing your content, it does offer multiple options for alerting them. You\u2019ll be able to view statistics and a visitor counter in a widgetized dashboard as well.&nbsp;<\/p>\n\n\n\n<p>The free version has enough features to get you started. You can choose from compliant, aggressive, or transparent approaches to notify your users that their AdBlock software means they\u2019re missing out on some of your content. <a href=\"https:\/\/www.getadmiral.com\/pricing\">Pricing for the premium version<\/a> is packaged with other products from the developer.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. <a href=\"https:\/\/wordpress.org\/plugins\/ad-inserter\/\">Ad Inserter<\/a><\/h3>\n\n\n\n<p>Another option is to look at a more comprehensive plugin solution. <a href=\"https:\/\/wordpress.org\/plugins\/ad-inserter\/\">Ad Inserter<\/a> can handle all your promotion-related needs and comes with AdBlock detection and notification features.&nbsp;<\/p>\n\n\n\n<p>With the free version, you\u2019ll be able to detect users who are preventing promotional content from loading. However, to use notifications, replacements, or other related functionality, you\u2019ll need to upgrade to the <a href=\"https:\/\/adinserter.pro\/\">pro version<\/a>. It starts at $22 for use on two websites and includes free updates for a year.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What If AdBlock Is Detected?<\/h2>\n\n\n\n<p>We\u2019ve covered several approaches to detecting AdBlock on your WordPress website. Deciding what to do if a visitor is using AdBlock is really up to you. We\u2019ve looked at three paths you might take below.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Allow AdBlock Users On-Site (Do Nothing)<\/h3>\n\n\n\n<p>The option we recommend is essentially to do nothing. While it\u2019s tempting to try to preserve your revenue by turning AdBlock users away, you don\u2019t want to miss out on traffic. Plus, not all applications follow the same protocols. What works to keep out users of one may not work for another.&nbsp;<\/p>\n\n\n\n<p>That being said, there\u2019s little harm in letting AdBlock users onto your website. You detect they\u2019re preventing some elements from loading you can <a href=\"https:\/\/www.labnol.org\/internet\/alternate-content-for-adblock\/28602\/\">serve up alternative content<\/a> in those spaces instead. This can get tricky, but it\u2019s an approach worth trying if you have the programming resources.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Send a Prompt<\/h3>\n\n\n\n<p>We covered this option when we discussed inserting some JavaScript into your website files or using a plugin to detect AdBlock users. This is a pretty compliant and balanced approach. It simply sends users a notification that some of your content is not viewable due to their ad-blocking software.&nbsp;<\/p>\n\n\n\n<p>Alternatively, users faced with a popup might just leave and not come back. For this reason, it\u2019s not our first choice. Visitors install AdBlock for a reason, and if your website is aggressively promotion-heavy, further aggravating them won\u2019t likely be beneficial to you.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Block AdBlock traffic<\/h3>\n\n\n\n<p>As anti-AdBlock options evolve, so do the ad-blocking applications. This can make it difficult to maintain strategies to circumvent them. Methods used in the past may become defunct as software for filtering out promotions is updated.<\/p>\n\n\n\n<p>That said, there are ways to <a href=\"https:\/\/www.thewindowsclub.com\/techniques-to-block-adblock-users-on-your-website\">completely prevent traffic<\/a> from users with AdBlock installed. You can find set notifications asking them to whitelist your site or turn off their extension. However, if your posts aren\u2019t engaging enough to attract visitors who are strongly opposed to promotional content, this isn\u2019t likely to benefit you much.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Grow Your Digital Business With WP Engine<\/h2>\n\n\n\n<p>Tackling problems that might arise due to AdBlock can be easier with expert <a href=\"https:\/\/developer.wordpress.org\/\">developer resources<\/a>. Ultimately, it\u2019s vital that your website provides a high quality digital experience for all of your visitors so that you can land conversions and grow your income, even without ad revenue.<\/p>\n\n\n\n<p>Here at WP Engine, we offer many <a href=\"https:\/\/wpengine.com\/plans\/\">web hosting plans<\/a> and eCommerce solutions to help you create the best experience for your visitors. Check out our options for your next project and gain access to our expert WordPress professionals today!&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s understandable that some internet users might want to tone down the number of ads on certain websites. After all, it\u2019s a plus that visitors want to focus on your content over promotional messages. However, as a blogger, you might be losing revenue because of this.&nbsp; Fortunately, there are several ways to work around ad-blocking<span class=\"tile__ellipses\">&hellip;<\/span><span class=\"tile__ellipses--animated\"><\/span><\/p>\n","protected":false},"author":177,"featured_media":0,"template":"","resource-topic":[904],"resource-role":[895,906,897,903,899],"resource-type":[916],"class_list":["post-99724","resource","type-resource","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Detecting Adblock Users On Your WordPress Site | WP Engine\u00ae<\/title>\n<meta name=\"description\" content=\"WordPress AdBlock detectors can be helpful when trying to keep users engaged, but ensuring your site is still profitable. Discover how to detect adblock on your WordPress site with WP Engine!\" \/>\n<meta name=\"robots\" content=\"noindex, follow\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Detecting Adblock Users On Your WordPress Site | WP Engine\u00ae\" \/>\n<meta property=\"og:description\" content=\"WordPress AdBlock detectors can be helpful when trying to keep users engaged, but ensuring your site is still profitable. Discover how to detect adblock on your WordPress site with WP Engine!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/\" \/>\n<meta property=\"og:site_name\" content=\"WP Engine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/wpengine\" \/>\n<meta property=\"article:modified_time\" content=\"2022-02-02T02:27:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2024\/05\/WPE-IMG-Thumbnail-1200x630-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@wpengine\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/\",\"url\":\"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/\",\"name\":\"Detecting Adblock Users On Your WordPress Site | WP Engine\u00ae\",\"isPartOf\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\"},\"datePublished\":\"2020-02-12T17:34:35+00:00\",\"dateModified\":\"2022-02-02T02:27:19+00:00\",\"description\":\"WordPress AdBlock detectors can be helpful when trying to keep users engaged, but ensuring your site is still profitable. Discover how to detect adblock on your WordPress site with WP Engine!\",\"breadcrumb\":{\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/wpengine.com\/case-studies\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Resources\",\"item\":\"https:\/\/wpengine.com\/case-studies\/resources\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Detecting Adblock Users On Your WordPress Site\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#website\",\"url\":\"https:\/\/wpengine.com\/case-studies\/\",\"name\":\"WP Engine\",\"description\":\"Managed Hosting for WordPress\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/aba73ed4c15eda43b5fd78844ec31fad\",\"name\":\"Samantha Rodriguez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g\",\"caption\":\"Samantha Rodriguez\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Detecting Adblock Users On Your WordPress Site | WP Engine\u00ae","description":"WordPress AdBlock detectors can be helpful when trying to keep users engaged, but ensuring your site is still profitable. Discover how to detect adblock on your WordPress site with WP Engine!","robots":{"index":"noindex","follow":"follow"},"og_locale":"en_US","og_type":"article","og_title":"Detecting Adblock Users On Your WordPress Site | WP Engine\u00ae","og_description":"WordPress AdBlock detectors can be helpful when trying to keep users engaged, but ensuring your site is still profitable. Discover how to detect adblock on your WordPress site with WP Engine!","og_url":"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/","og_site_name":"WP Engine","article_publisher":"https:\/\/www.facebook.com\/wpengine","article_modified_time":"2022-02-02T02:27:19+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2024\/05\/WPE-IMG-Thumbnail-1200x630-1.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@wpengine","twitter_misc":{"Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/","url":"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/","name":"Detecting Adblock Users On Your WordPress Site | WP Engine\u00ae","isPartOf":{"@id":"https:\/\/wpengine.com\/case-studies\/#website"},"datePublished":"2020-02-12T17:34:35+00:00","dateModified":"2022-02-02T02:27:19+00:00","description":"WordPress AdBlock detectors can be helpful when trying to keep users engaged, but ensuring your site is still profitable. Discover how to detect adblock on your WordPress site with WP Engine!","breadcrumb":{"@id":"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/wpengine.com\/case-studies\/resources\/detect-adblock-wordpress\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/wpengine.com\/case-studies\/"},{"@type":"ListItem","position":2,"name":"Resources","item":"https:\/\/wpengine.com\/case-studies\/resources\/"},{"@type":"ListItem","position":3,"name":"Detecting Adblock Users On Your WordPress Site"}]},{"@type":"WebSite","@id":"https:\/\/wpengine.com\/case-studies\/#website","url":"https:\/\/wpengine.com\/case-studies\/","name":"WP Engine","description":"Managed Hosting for WordPress","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wpengine.com\/case-studies\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/aba73ed4c15eda43b5fd78844ec31fad","name":"Samantha Rodriguez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wpengine.com\/case-studies\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/933722cf8761e0c08fbced6085998032df460c5ecfa2481d9cd16f569f3da2c1?s=96&d=mm&r=g","caption":"Samantha Rodriguez"}}]}},"acf":[],"grid_image_url":"https:\/\/wpengine.com\/case-studies\/wp-content\/uploads\/2020\/02\/shutterstock_702304798.jpg","media-type":{"term_id":916,"name":"Article","slug":"article"},"role":"<strong>Roles:<\/strong> Agency, Entrepreneur, Freelancer, Marketer, Site Owner","topic":"<strong>Topics:<\/strong> Marketing","_links":{"self":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource\/99724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource"}],"about":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/types\/resource"}],"author":[{"embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/users\/177"}],"wp:attachment":[{"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/media?parent=99724"}],"wp:term":[{"taxonomy":"resource-topic","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-topic?post=99724"},{"taxonomy":"resource-role","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-role?post=99724"},{"taxonomy":"resource-type","embeddable":true,"href":"https:\/\/wpengine.com\/case-studies\/wp-json\/wp\/v2\/resource-type?post=99724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}