Back to Blog
Guide8 min read

Can You Block Ads Served From the Same Website Domain? My Thoughts

I came across a discussion about blocking ads served from the same domain as the content, and it raises some interesting points about the limitations of traditional ad blocking.

T

The AdBlock Mobile Team

December 12, 2025

I recently stumbled upon a conversation highlighting a frustrating problem: ads served directly from the website's own domain. This got me thinking about the evolving landscape of ad blocking and the challenges we face in providing a truly seamless, ad-free experience on mobile devices.

The specific example involved someone using Pinterest and being bombarded with ads, even with ad blocking solutions like AdGuard DNS and AdBlock Plus enabled. The user correctly suspected that the ads were originating from Pinterest's own servers, effectively bypassing traditional blocklists.

This situation highlights a critical limitation of many ad blocking methods. While DNS-based blocking and browser extensions are excellent at filtering out ads served from known third-party ad networks, they often struggle when the ads are cleverly integrated into the main website's content delivery network (CDN).

Let’s delve into why this happens and what potential solutions exist.

The Challenge of First-Party Ads

Traditional ad blocking relies on identifying and blocking requests to known ad servers. These servers typically belong to companies specializing in advertising, like Google's DoubleClick (now Google Ad Manager) or various other ad networks. Blocklists, like those used by AdGuard or uBlock Origin, contain lists of these domains and prevent your browser or device from communicating with them.

However, when a website serves ads from its own domain, the ad requests appear to be legitimate requests for content. Your browser can’t easily distinguish between an ad and a genuine image or script that's part of the website's core functionality. This is because both the ad and the content share the same origin.

This technique, often referred to as “first-party ad serving,” is becoming increasingly common as websites seek to circumvent ad blockers and maintain revenue streams. It's a cat-and-mouse game, and ad blockers need to adapt to stay ahead.

Why DNS-Based Blocking Fails

DNS-based ad blocking, like AdBlock for Mobile, works by filtering domain name resolution. When your device tries to access a website, it first needs to translate the domain name (e.g., example.com) into an IP address. A DNS server performs this translation.

Ad blocking DNS servers maintain blocklists of known ad domains. If your device tries to resolve the domain of an ad server, the DNS server can either refuse to provide an IP address or provide a “sinkhole” IP address that leads nowhere. This prevents your device from connecting to the ad server.

However, when ads are served from the same domain as the website, there's no separate ad domain to block. The DNS request is for the website's main domain, which needs to be resolved for the website to function correctly. Blocking the entire domain would effectively block the entire website, rendering it unusable.

Browser Extensions: A Partial Solution

Browser extensions like AdBlock Plus or uBlock Origin offer more sophisticated filtering capabilities than DNS-based blocking. These extensions can analyze the content of web pages and block specific elements based on their URLs, CSS classes, or other attributes.

While browser extensions can sometimes block first-party ads, they are not always successful. Websites can obfuscate their ad code to make it difficult for extensions to identify and block. Additionally, aggressive filtering can sometimes break website functionality, leading to a poor user experience.

In the case of the Pinterest user, even with AdBlock Plus installed, the ads were still getting through. This suggests that Pinterest is employing techniques to make its ads difficult to detect.

Potential Strategies for Blocking First-Party Ads

So, what can be done to block ads served from the same website domain?

Here are some potential strategies:

1. Advanced Content Filtering

The most effective approach involves advanced content filtering that goes beyond simple blocklists. This requires analyzing the structure and content of web pages to identify and block ad elements based on their characteristics.

For example, an ad blocker could look for specific CSS classes or JavaScript code patterns that are commonly used to display ads. It could also analyze the content of images and videos to identify promotional material.

This type of filtering requires more processing power and can potentially slow down browsing. However, it offers a higher degree of accuracy and can be more effective at blocking first-party ads.

2. User-Defined Filters

Many ad blockers allow users to create their own custom filters. These filters can be used to block specific elements on web pages based on their URLs, CSS selectors, or other attributes.

While creating custom filters can be time-consuming, it can be a powerful way to block ads that are not blocked by default. The Pinterest user, for example, could try creating custom filters to block specific ad elements on Pinterest's website.

However, user-defined filters require technical knowledge and can be difficult to maintain. Websites often change their code, which can break existing filters. Also, they only work on the specific device and browser where they are configured and are not system-wide.

3. Machine Learning

Machine learning techniques can be used to automatically identify and block ads based on their visual and textual characteristics. A machine learning model can be trained on a large dataset of ads and non-ads to learn to distinguish between the two.

This approach has the potential to be very effective at blocking first-party ads, as it doesn't rely on specific blocklists or rules. However, it requires significant computational resources and a large amount of training data.

4. Host File Editing (Advanced Users)

For advanced users, manually editing the host file on their device can provide a more granular level of control over network traffic. The host file maps domain names to IP addresses. By adding entries to the host file, you can redirect traffic to specific domains to a different IP address, such as a local “sinkhole” or even a non-routable address.

While this method can be effective for blocking specific domains, it requires technical expertise and carries some risk. Incorrectly editing the host file can disrupt network connectivity.

5. Content Blocking Apps (iOS)

On iOS, content blocking apps can be used to block specific types of content in Safari. These apps use Safari's content blocking API to filter web pages before they are rendered. While DNS-based blocking provides system-wide protection, content blocking apps only function within Safari.

Content blocking apps can be configured to block images, scripts, and other types of content. They can also be used to block specific URLs or CSS selectors. This can be useful for blocking first-party ads that are served from specific locations on a website.

6. Local VPN-Based Ad Blockers

Apps like Blokada for Android create a local VPN on your device and filter all network traffic through it. This allows them to block ads and trackers system-wide, even in apps. The advantage is that they don't route your traffic through an external VPN server, maintaining your speed and privacy.

The Importance of Community and Collaboration

Combating first-party ad serving requires a collaborative effort from the ad blocking community. Sharing custom filters, reporting problematic websites, and contributing to open-source ad blocking projects can help to improve the effectiveness of ad blocking solutions.

The rise of first-party ad serving also highlights the need for more sophisticated ad blocking technologies. Simple blocklists are no longer sufficient. Ad blockers need to employ advanced content filtering, machine learning, and other techniques to stay ahead of the curve.

AdBlock for Mobile's Approach

At AdBlock for Mobile, we are constantly working to improve our ad blocking capabilities and address the challenges posed by first-party ad serving. We are exploring advanced content filtering techniques and machine learning models to enhance our ability to identify and block ads, even when they are served from the same website domain.

We also rely on community feedback to identify problematic websites and improve our blocklists. If you encounter ads that are not being blocked, please let us know. Your feedback helps us to make AdBlock for Mobile even more effective.

The Future of Ad Blocking

The future of ad blocking will likely involve a combination of different techniques. DNS-based blocking will continue to be an important first line of defense, but it will need to be supplemented by more sophisticated content filtering and machine learning techniques.

Browser extensions and local VPN apps will also play a key role, providing users with more granular control over their browsing experience.

Ultimately, the goal is to provide users with a seamless, ad-free browsing experience without compromising website functionality or privacy. This requires a collaborative effort from the ad blocking community, as well as ongoing innovation and adaptation.

It's a constant evolution, and we're committed to staying ahead of the curve to provide the best possible ad blocking experience for our users.

Ready to Block Ads?

Follow my step-by-step guide and start browsing ad-free in under 30 seconds.

Get Started Free