How Does Ad Blockers Work: The Definitive Guide

The easiest way to stop online ads is to round up advertisers and exile them somewhere on a desert island. Let’s see how they sell online casinos to each other under such circumstances, am I right? Although this idea sounds quite entertaining and can be the basis of a reality show, no one has the time for that. This article will tell you how ad blocking works and how to use ad blockers to get the most out of them.  

Introduction

Simply put, an ad blocker like AdLock doesn’t allow your browser or other apps that display web content to download ads. This can be done in several ways: AdLock can block communication between a browser and advertising server or block connection with a website from its blacklist. The most important thing is to settle explicit ad-blocking filters so that an application can’t block the whole innocent web source by mistake.

How an Ad Blocker Works in Simple Words

Ad blockers have a list of bad web addresses where ads live. Websites send requests to that addresses, inviting ads to come, ad blockers throw away those requests, and adverts never get them. Thus, ads can’t load. 

Some ad blockers are less advanced and just brush ads under the carpet. Such software doesn’t block ad requests and hides elements already uploaded to the page.

What Are Ad Blockers?

Essentially, an adblocker is a software unit. Depending on the developer and the product, adblockers vary from simple browser extensions working on browsers while others are standalone programs covering all browsers and programs on users’ devices. Despite the name, adblockers don’t actually block ads in the literal sense. Definitely, they remove ad-containing blocks and frames from displaying but it doesn’t mean advertisement goes away from the Internet.

How Does Ad Blocking Work

The type of software defines the way ad blocker works. I’ll show you the most common ad blocking software and how they operate in this block.  

Browser Extensions

The browser plugins are the most popular type of ad-blocking software. When a webpage is loading, the ad blocker compares the site’s scripts and links against the list of what a plugin means to block. In this case, adblockers work is restricted by browsers’ permissions. 

Separate App

Ok, we figured out the extension, but how does ad blocking work in a separate app? The answer is: pretty much the same. A standalone application applies the same filter rules, but its functionality is not limited by the browser, so the ad-blocking feature works slicker and more comprehensively. In addition, a system-wide ad blocker stops ads in all browsers, games, apps, etc. 

Built-in browser ad blockers (Opera, Brave)

How does ad block work when it’s implemented in a browser? You may laugh, but quite the same, too. The built-in ad blockers are superior to add-ons because they make loading websites faster since they don’t need to duplicate processes the browser runs to remove ads. Also, ad-blocking browsers usually don’t have limitations like regular browsers and tend to remove more ads.

VPNs/DNS

VPN/DNS ad blockers stop requests to the ad servers. Software that relies solely on VPN/DNS filtering to block ads is less effective as it doesn’t cope with native ads. I cover in detail this filtering type further in the article.

Where do ad-blocking filters come from

In general, it’s easy to recognize ads as most of them are downloaded from similar web servers. The complicated part is to identify which content is commercial and which is not and to settle accurate rules of displaying. Maybe in foreseeable future, we will be able to delegate this menial work to artificial intelligence but so far thousands of developers and just non-indifferent people all over the world work daily on creating the fullest list of ad-blocking filters. Ad-blocking filters give instructions to an application on which content shouldn’t be downloaded.

When you install ad blocker for Android, you’ll get an opportunity to customize advertising filters. For example, if you have few favorite websites which you know live on ads, you may add their URLs to the list of exceptions. Websites will continue making a profit, and you will feel better about yourself.

It’s a global practice for all modern ad blockers, including AdLock to use established and permanently improving filter-list from the web but apart from that, AdLock develops its own filters likewise. It helps to enhance our application and stay one step ahead of the competition. AdLock’s adblocking process is based on those filters and conducted in 5 steps:

  • DNS filtering
  • URL filtering
  • Content filtering
  • CSS injection
  • JS injection

Below we will take a close look at each of the five steps separately.

DNS Filtering

Before downloading a website, your browser or an app sends a request to your operating system, which returns a valid IP address. AdLock works as a mediator between these processes. To facilitate understanding, let’s say AdLock is a telephone operator, and an advertising domain server is a dial number. When your browser tries reaching the ads server through the operator, which is AdLock, it tells you that this number doesn’t exist. The browser can’t get to the advertising server and can’t download ads from it.

Despite the simplicity, DNS ad-blocking work stays imperfect as it ruins how the website is displayed. Website owners want to make money, so they write adverts into the source code. When we forbid our browser to download commercial content, it lefts empty spaces where ads and banners are supposed to be. The result would be similar to the artworks of Jorge Pérez Higuera, a Spanish photographer who presented how the world would look without ads. We can’t let you use a website with such a catastrophic design. And we apply many other filters to return a harmonious web page look.

how to block ads - dns filtration - adlock

URL Filtering

DNS filtering can be successfully applied only if ads are downloaded from a third-party domain. If ads are located on the website’s domain, we need to analyze the website’s URL. Let’s imagine a website with the URL xxxzzyyy.com, the advertisement on this website will be downloaded from the URL xxxzzyyy.com/ads. URL filter reads a website’s URL and checks whether it requests the advertisement content and if so, the URL filter blocks such request.

Take into account this filtering method (and all of described further) needs certificate installation for filtering HTTPS connections.

Content Filter

Before letting your browser download a website AdLock’s content filter scans the contents of the website’s HTML source code and cuts off elements that don’t pass ad-blocking filters. This filtering algorithm scans each HTML element (going down from the head of the HTML tree to each subelement) according to filtering rules, taking a lot of CPU time and process memory. That is why this method of ad filtering is considered to be outdated, as more effective and modern methods exist (see below).

how to block ads on google chrome - adlock

CSS Injection

CSS injection is applied after DNS, URL, and Content filtering are done. First, let’s figure out what is CSS. CSS stands for cascading style sheet through which website developers tell our browser how to display each web page (which colors to use, what font, images, etc.) CSS also specifies the size of spaces reserved for adverts, that’s why when DNS filter blocks ads there are holes left instead of them in the website design. In order to put those holes away, we apply our CSS injection the moment the browser downloads a website. CSS injection tells that adverts spread over zero pixels in length and zero pixels in width or as such don’t exist. Next, content elements pull up to take advert places returning the web page its clear and laconic exterior.

JS Injection

In many cases, developers don’t use direct links or frames to download advertising on a web page. Frequently they use a custom javascript to tell your browser where, from where, and what ads elements it has to download. After the browser completes downloading all HTML content elements of the page JS script runs to settle banners, pop-ups, etc. You undoubtedly noticed that on some websites ads appeared only when a current web page completed rendering. It was especially evident if you had a bad connection or slow internet. Thereby Javascript provides data for adverts to appear on a website whether they are downloaded from a third-party domain or written into the source code. In order to suppress advertising scripts, we inject our own JS code which contains all adblocking mechanisms to counteract ads.

How Do Ad Blockers Detect Ads?

The algorithm for tracing and blocking ads is different from adblocker to adblocker but the fundamental goal for each of them is to read/listen to the content loading while the webpage is getting ready to be displayed to the user. Before any content is rendered, adblockers compare it to a filter list, block matches, and then tell the browser what to render. So, basically, adblockers have the final word determining the content to be displayed. Carefully curated and maintained filter lists help adblockers to clean up users’ online activity in an elegant way.

The Pros & Cons of Ad Blockers

It’s time for a long-awaited dotted list! Now you’ll learn what ad blockers do that may advantage and disadvantage your online experience.

Pros of using ad blockers:

  • no ads, obviously, and no fake news and offers distinguished as ads;
  • reduced bandwidth;
  • web-pages load faster;
  • the phone doesn’t overheat trying to download heavy elements;
  • battery lasts longer;
  • privacy is more protected.

Cons of using ad blockers:

  • rough filter rules can block non-ad related elements or the whole website;
  • small websites that live from ads lose essential revenue;
  • some websites detect ad blockers and hide content until you whitelist them.

Pros don’t need a particular explanation, so let’s look at the cons on the example of AdLock. Our app may block a website or break the way it displays, as there are millions of websites, and we can’t tune the rules for each. But you can. Whitelist the website or adjust the ad filters in the application’s settings. As for the detection of an ad block, AdLock is quite sneaky and runs unnoticeably on most websites. Still, there are many websites, and some can use more advanced detection, so if you don’t mind, you can expose those sites to our support team, and we will handle them. As for lost revenues, if you want a certain website to prosper, whitelist it and let it earn money from advertising. FYI, we have the whole article dedicated to the benefits of ad blocking, and it will make you feel better about yourself.

How Can I Notice the Impact of an Ad Blocker on My Website?

While ad blockers work on improving their filters to not interfere with the site’s performance, they still can influence it, unfortunately.  

Ad blockers may affect the tracking of users

Some software scoops the advertising scripts and analytics all in one heap and blocks them mercilessly. For you, it means you won’t know the exact number of visitors because ad blocker users will stay out of the picture.  

We suggest you test the tracking on your site with as many ad blockers as possible. Also, there is an option of embedding a javascript that will show how many users had their ad blockers enabled while using your website. 

Ad blockers can ruin the way your website is displayed

Some apps block elements that are not advertising and leave gaps instead of them. Images, videos, and calls for action often fall into that unlucky category. Users don’t associate poor site performance with their usage of ad blockers and just leave. Of course, it’s not your fault but your money. We can only recommend that you don’t use JavaScript for essential elements, as usually, they are the ones that are being affected. 

Is It Worth Fighting Ad Blockers?

There will be no winners in this fight. Try to put yourself in your user’s shoes. They have their ad blocker working for a reason. They are tired of false promises, being shouted all the time to buy something, and feeling bad about themselves because not all ads are ethical. Some ads can exploit inner insecurities to sell a product or even guilt-trip people into participating in a scammy charity. And hiding your content until they turn off an ad blocker won’t earn you any trust. Users will most likely leave your web page and find the information elsewhere. 
Ad blocker users are still a minority. As of 2021, the average ad-blocking rate is around 37%, so most of your users don’t use ad-preventing software. Stick to native advertising, make your content helpful and engaging, and from time to time, ask users politely to allowlist your website. That’s the best you can do.

FAQ

Is ad blocking safe?

Talking of safety, you should only trust legitimate apps and services. There are dozens of diverse scam “adblockers” from noname developers making people fall victim to tricky scammers and lose faith. Oftentimes such scam services operate using similar names to legitimate apps. But if we talk of legit products, then it’s worth admitting they will never collect any data concerning your online activity and will never read/process any sort of financial operations on your device.

The cherry on top, some serious and solid adblockers provide additional security tools protecting users from being scammed, phished, or infected with malicious software embedded in ad scripts.

How do ad blockers make money?

It’s an interesting topic. You may say “There are free adblockers, why should I buy one?”, but here’s the thing.
Free adblockers either earn through the acceptable ads program participation, or they collect your data and sell it to advertisers. Paid services in their turn provide full protection of data and additional online security for a fair price of a monthly subscription. Some startups earn through donations but it’s clear that a couple of hundred dollars would not support further enhancements and development, so they search for additional income.

Is it good to use an ad blocker?

Yes, not only do ad blockers make the web page look good, but they also hide potentially harmful or scammy ads. Shady adverts can contain redirects that will lead you to the equally shady website. 

Do ad blockers block all ads?

Yes, ad blockers can hide all types of ads that websites download from an advertising server. The only kind of ads that is beyond their strengths is sponsored posts. Partners write posts promoting their products and pay websites to publish them.

Are ad blockers harmful?

It depends. Any free software can be harmful because you don’t know the origin of its profit. Paid ad blockers and open-source ad blockers are more trustworthy. The first ones get your money, and their best interest is to provide you with a reliable product, and the second ones let you verify whether they are secure. Of course, you should look at the reputation of each piece of software to make the right choice. We can only speak for AdLock as we are sure of its safety. 

Download for

Do you like this post? Share it!
Kostya Shebanov

Kostya Shebanov

Product Owner at Hankuper s.r.o., Proud dad

Led by knowledge, insight, and a pool of fresh ideas, Kostiantyn is a spectacular example of an inexhaustive leader. Outside of business, he is an energetic outdoorsman and family guy.