Investigate and hack into any Chrome Extension
from the Chrome WebStore.

How does Adblock work?

Attention! Long-read!

What is adblocker and how does an ads in the web work?

I believe that everyone who surfs the web hates ads that pop out here and there, asking you to buy something, to download some "free" stuff or do anything but viewing the page you were looking for in Google so long.

But we know that advertising makes some profits for website owners. Lucky ones can have thousands and dozens thousands dollars of monthly income. It enables them to create more and more useful and valuable content. They build the web we love and use everyday.

Not all ads make us angry. There are several types of ads especially annoying, such as pop-up and pop-under ads, that either cover whole screen or turning the page we were looking at into strange bunch of irrelevant marketing fluff. Here is the place where adblock solutions come to help, and in this article we cover the topic about how do adblockers work.

What the hack adblockers are?

Huge publishers like Google are staying away from websites that use "gray" techniques to drive profits out of traffic (i.e. CPC arbitrage). They use content filtering and ranking techniques to defend user from aggressive ads.

It helps them keep content relevant to user's queries. They know, that theirs' massive profits backed with investors expectations depend highly on user satisfaction and usability. If a user watches irrelevant, ugly, misspelled ads, big chance is that user will skip further ads and possibly churn away and stop using such website or online product or mobile app.

Not all site owners do like Google does. Also, Google can't control every possible ad, because a lot of webmasters use ad networks for displaying ads that aren't affiliated with Google.

You got the idea: Google improves ads on his own, but to control ads on user's side user need some additional software. Such software exist and is called "adblockers".

How do Adblockers work?

Typically, ad-blocking works through filtering out a content on the page that user interact with and removing out some blocks of text, images, javascripts or flash. To decide what to remove, an adblocker use very simple rules created by developer. No matter how sophisticated ads code is, it will have some features like specified HTML-tags or styles. Developer finds such features and add them as rules for filtering.

For example, if a page contains an image with URL that contains word "ad" or "affiliate", the image become a candidate for removal.

This is the browser-based adblocking. It is exactly how AdblockPlus works.

In addition to browser-based solutions, there are proxy-based solutions. For example, AdblockPlus work in this manner on Android devices. The idea is to filter out not a content, because AdblockPlus on Android have no access to content the user watch, but filter out HTTP requests being used to get banner images or texts.

To achieve such filtering abilities, user run a HTTP-proxy server on his device, he does it using AdblockPlus app, and configures network to drive all traffic through this proxy.

If you aren't familiar with Proxy Servers, just look to corresponding Wikipedia page. Proxy server are easy to understand. And the concept is very straightforward.

Adblock Plus

Nowadays, more than 100 millions of devices have installed AdBlock Plus. It is the most popular and sensational adblocker. It is free and open-source.

We can look into source code. Go, grab it using CRXExtractor! This is a link you should use to download him: https://chrome.google.com/webstore/detail/adblock-plus/cfhdojbkjhnklbpkdaibdccddilifddb. Just put this link into corresponding field and extract it using tool.

Open

lib/adblockplus.js
. If you go over the source code you will easily find 1417-1467 lines. There are URLs pointing to
adblockplus.org
, where you can get actual filters that AdblockPlus apply to content of websites in order to block ads from popping.