Ad Tech - Ad Blocker

Many people has Ad Blocker installed. But you might wonder how Ad Blocker block ads.

Usually, Ad Blocker has two method to block ads. First, is block ad request. Second, is to remove ad frame from the page. They both belong to pattern matching.

Blacklist

Taking Ad Blocker Plus as an example here. They use easylist as their base blacklist. It is a open source blacklist. it looks like this.

&ad_channel=
&ad_classid=
&ad_code=
&ad_height=
&ad_ids=
&ad_keyword=
...

Whatever request match pattern inside the list will be blocked. For example, using chrome extension API.

Remove Ad element from page

Pretty much the same as above one. Insted of matching request, it match webpage element. For example

 <ad><iframe/></ad>

It will remove all the iframe tag in side <ad> tag.

Conclusion

It sound easy, but actually it is very hard. One major difficulity is the performance. Most of the website has more than hundreds of request, and the simple match method require O(n^m) where there are n requests and m patterns. This is obvious too slow. If you are interested about how they improve the performace, you can read this article Adblock Plus and (a little) more, Investigating filter matching algorithms.

Subscribe to Waiting & BN

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
jamie@example.com
Subscribe