Skip to main content
Roughly 40% of web users use adblock, which can significantly reduce ad revenue. We offer an Adblock API which enables you to prompt adblock users to support the site. This API is available as a separate module that you can add to your site by including an additional script tag. We designed this module to be fast and lightweight, with a gzipped size of under 0.3 kB and requiring no external dependencies.

Enable Wrapper Adblock API

Add the Adblock API Module code to the <head> section of your webpage. We put an id so you can remember what it’s for :)
<script id="rev-adblock-api">
(function(){var e=`rev_adblock`,t=localStorage,n=atob(`aHR0cHM6Ly9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvanMvYWRzYnlnb29nbGUuanM`),r=fetch(n,{method:`HEAD`}).then(e=>!(e.ok&&!e.redirected)).catch(()=>!0).then(n=>n&&(t[e]=!0)),i=globalThis.reviq||=[];i.checkAdblock=()=>r,i.onAdblock=e=>r.then(t=>t&&e()),i.push(n=>r.then(()=>t[e]&&n.setKv(e,1)))})();
</script>

Using the Adblock API

Note: You should NOT use the command queue (reviq.push(cmd)) for these functions. These functions are always available immediately after the Adblock API Module is loaded.
Suppose you have some function showAdblockModal that shows a modal asking users to disable adblock. reviq.onAdblock(cb): runs a callback cb if adblock is detected
reviq.onAdblock(() => {
   // This only runs if adblock is detected
   showAdblockModal();
});
checkAdblock(): must be awaited and returns true if adblock is detected, false otherwise
// Check for adblock 
const hasAdblock = await reviq.checkAdblock();
if (hasAdblock) {
   showAdblockModal();
}