How does a site "detect" an ad blocker?

Hello there!

First, I’m assuming that what’s happening is based in JS somehow. I apologize if there’s a better place for this topic.

Secondly, this is just to satisfy my curiosity. I’m not building, breaking or bypassing anything. At the most, I’ll write some code to play with to find out how it works.

I use more than one ad blocker. I use one for apps and sites, then I use more specific addons to block problematic sites like facebook. When visiting sites, I will sometimes get the adblock nag or overlay and FB has recently been showing “You’re missing out because of your adblocker” type blocks.

Which left me wondering; how does a site reliably determine that an ad blocker is being used? Is there some type of jquery async connection that sees that a particular block of code is being routed to a blackhole instead of being properly received? I remember early on in email campaigning that we would plant an image that was served by a php script to know when an email was being read. Of course, that’s not feasible now, as most mail clients block images by default until told to do otherwise so those campaign emails would need another way to determine read/unread and I’m betting it works similarly to determining the presence of an ad blocker.

If you know, I’d love to hear about it and if you don’t know but can think of an idea for how it would work, I’d be just as interested in your thoughts as well.

Thanks for your time!

Some ad blockers remove the element that contains the advert, and other ad blockers keep the element but set the display or opacity to none.

All of those things can be checked by JavaScript, to find out if they’ve occurred.

The things done by ad blockers are done pretty much immediately on the page loading, so a site can delay running a checking script by a few seconds after the page loads, to check if the ads have been interfered with.

And does this always occur via an async function of some sort? After I load the page a check is made x amount of time after to look for an element name in the page?

Yes, it has to, otherwise it risks being too late to notice any changes that occurred.

I think emails work differently. You are correct in that an image is used to detect an ‘open’ if images are allowed, this is then suplimented with link click information. All of the links on an email have unique ids, so if you click one, even if images are blocked, your id will be logged against that email as being opened.
Well that is my understanding at least

This thread has been about sites detecting an ad blocker. Emails are quite a different and unrelated thing.

The OP clearly included a statement about emails and how they thought they worked in the same way as an ad blocker. I believe my answer was well within the scope of the OPs questions/statements and did indeed clarify that emails are handled in a different way to ad blockers.

Sorry for sounding brusque earlier, the quote really helped with the context.

First we must define what ad block means. The obvious definition is that advertisements are blocked in some manner. However websites are sometimes using the term in a very different manner. The website titantv dot com complains when we (they say) are using an ad blocker, but the fix they provide to enable ads is actually to change a setting to allow tracking. Very different. And since it is a feature of the browser, I assume the browser provides a way to check that feature from code.

I have wanted to know how to find and remove timers set by the website. If there is a way to do that then that should be a separate discussion therefore I will say no more here.

My understanding is that you can only clear a timer when you have a reference to it, and that is achieved when setting the timer. https://developer.mozilla.org/en-US/docs/Web/API/clearTimeout

Hello there again, everyone :slight_smile:
I found this link showing an example of how an adblock detector would work. I see the honeypot element that looks for it’s existence in the browser(I think). Is this the timer that we’re discussing?

}, 2000);

and then once the 2000ms has transpired, it loads the listener?

        /* Add a page load listener */
        if(window.addEventListener) {
            window.addEventListener('load', detector, false);
        }

I think the opposite of that happens. The addEventListener says to execute detector when the page has been loaded. Then setTimeout sets a timer to execute some code after 2 seconds.

That much I understand. The challenge is getting the handle (by code injected into the page or something like that) set by the JavaScript in the page.

That can only be done when you are in control of the code that’s running on the page.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.