Add

Lorem ipsum

Lorem ipsum

A
A
A
Easter egg

3 views

4 min

How to Detect AdBlock in Webflow and Display a Message

Learn how to detect whether a visitor is using an ad blocker in Webflow with the bait element technique.

In this tutorial, Sandro, cofounder of the Gemeos Webflow agency, shows you how to detect whether a visitor is using an ad blocker on your Webflow site and display a tailored message.

Example

🛡️

You're using an ad blocker

Our content is free and doesn't rely on intrusive ads. Consider whitelisting us to support the site.

Detecting...
TechniqueReliabilityPrinciple
Bait element (this tutorial)HighDiv with ad-related classes detected by AdBlock
Bait scriptVery highJS file with a name like 'ads.js' gets blocked
Third-party APIVery highDedicated service (Adversal, BlockAdBlock)

Understanding the principle

Ad blockers (uBlock Origin, AdBlock Plus, and others) use filter lists to hide elements whose class name or ID looks like an ad. The "bait" technique creates an invisible element with typical ad-related classes (adsbox, ad-banner, and so on). If AdBlock blocks it, the element ends up with zero size: you can then detect the presence of a blocker.

1. Create the message to display in Webflow

Create a Div with the ID adblock-message containing your message. Set it to display: none by default in your styles. This Div will only appear if AdBlock is detected.

2. Add the script in Footer code

(function() {
var bait = document.createElement('div');
bait.className = 'adsbox ad-banner pub_300x250';
bait.style.cssText = 'position:absolute;left:-9999px;width:1px;height:1px;';
document.body.appendChild(bait);
setTimeout(function() {
var blocked = bait.offsetHeight === 0 || bait.offsetWidth === 0 || !bait.offsetParent;
bait.remove();
if (blocked) {
var msg = document.getElementById('adblock-message');
if (msg) msg.style.display = 'block';
}
}, 100);
})();

3. Adapt the message

The content of the adblock-message Div is up to you. Effective message examples: a subtle banner asking visitors to whitelist your site, a modal explaining the impact on your free content, or an informative message without judgment.

good to know

Avoid aggressive or guilt-tripping messages: they create friction and drive visitors away. The most effective messages explain why your site doesn't show intrusive ads and simply ask to be whitelisted. A transparent, respectful tone converts much better than a forced block.

Conclusion

AdBlock detection lets you adapt your content or raise awareness with your visitors. Use cases:

  • Free content sites funded by advertising
  • Media outlets and blogs with a freemium model
  • Showing an alternative (subscription, donation) to users with AdBlock

Detection result on your current browser

Detecting...

Good to know

Heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Lorem ipsum dolor sit amet consectetur.

Lorem ipsum dolor sit amet consectetur. Aliquam orci sagittis dignissim sapien praesent donec.

Lorem ipsum

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

Published on

You might be interested in these tutorials

Similar tutorials

SEO / GEO

5 min read

5 views

How to Set Up a Redirect in Webflow? (2026)

Updated on 19.12.2025 by Sandro DA SILVA

SEO / GEO

5 min read

5 views

Add structured data to your Webflow site?

Updated on 21.08.2025 by Sandro DA SILVA

No-code

5 min read

5 views

How to Obfuscate a Link in Webflow

Updated on 23.04.2025 by Sandro DA SILVA

Let’s f*****G GO !!

Ready to launch
Your business?

Alexandre

Max

Enora

Bryan

Cannelle

Tiphaine

You'll :heart: our collaboration...