Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect ads?

I am trying to write a browser extension that will detect advertisements. I don't want an AdBlock, I just wish to detect how many ads are encountered. I don't know where to begin searching for ads in the HTML, though. Any help for a good first start?

like image 858
banana Avatar asked Jun 28 '18 17:06

banana


People also ask

How do ad blockers detect ads?

Ad blocking detection works by placing so-called “bait content” within the pages of a website. Although invisible to the user (it might, for example, be a single pixel in size), this bait content is implemented so as to appear to ad blockers as advertising content.

Can websites detect AdBlock?

While ad-blocking software can't be detected by the websites directly, one can assume their presence by testing whether particular elements of the page have been displayed.

How do anti ad blockers work?

Ad blockers are browser extensions or plugins that disable ads on specific web pages. An ad blocker works by blocking communications to ad servers and then hiding the elements of the web page that are designed to display advertising content.


1 Answers

Most adblockers catch the ads via some form of a regex match.

I would recommend you to start with the adblockpluscore repository, since it's open source and you can quickly run through the source code.

Start with the test directory, particularly peeking into the patterns.ini file and see the common patterns, when determining different sources of ads.

Search for these sections in patterns.ini:

  • General tracking systems
  • Third-party tracking domain

You can expect, that your initial solutions won't be too effective, since ads come in different forms of data, but you'll find common patterns between many of them.

like image 157
user7637745 Avatar answered Sep 21 '22 18:09

user7637745