DEV Community

Cover image for DevTip #1: Prevent Adblock Detection For Privacy
Wiz Lee
Wiz Lee

Posted on • Edited on

DevTip #1: Prevent Adblock Detection For Privacy

You are caught with the redirect below when browsing for articles to solve certain issue. This prevents you from looking at the content ๐Ÿคทโ€โ™‚๏ธ

Alt Text

This is a scenario that we might run into if we are using some types of adblocker or the built-in privacy tracker provided by browsers. In this post I will be sharing ๐Ÿ”ถthe solution followed by ๐Ÿ”ทthe methodology in arriving to the solution.

Before that, it is important to know that sometimes it is good to let the tracker / ads to go through. There are 3 scenarios that come into my mind now:

  • To support your content creator / sites.
  • To get a better browsing experience especially on banking sites.
  • To get better personalized ads and search results.

๐Ÿ”ถ Solution

My solution is to use a browser extension called uMatrix (Github, Chrome store, Firefox addon). It is noted that this extension is no longer in active development since Sept 2020, but up until now I haven't find other advanced default deny blocker that works as seamlessly as uMatrix.

Having stated all that, the way to be able to browse website such as tomsguide.com or techradar.com is to allow the traffic for "vanilla.futurecdn.net". You can either add the rule manually into the uMatrix rule setting, or use the uMatrix UI to do so.

uMatrix Rule

* vanilla.futurecdn.net script allow
Enter fullscreen mode Exit fullscreen mode

or

specific.siteurl.com vanilla.futurecdn.net script allow
Enter fullscreen mode Exit fullscreen mode

I am being more specific by allowing only 'script' from vanilla.futurecdn.net. However I think it is OK to allow everything by using the * wildcard.

uMatrix UI

  1. First press the extension icon.
  2. Toggle the 'power' icon to allow all traffic (temporary disable uMatrix)
  3. Refresh the website, which will result in everything being loaded.
  4. Press the extension icon, scroll to find 'vanilla.futurecdn.net' and click on it to allow all its traffic.

GIF below shows where to find the rule setting and the whole UI process.
Alt Text

๐Ÿ”ท Methodology

The motivation๐Ÿ”ฅ behind sharing the methodology is that this relates to how do I usually find a solution when debugging software. By sharing my thought process here publicly I hope this will benefit others while open up to better suggestions on my methodology.

  1. Firstly, I start by thinking of what tool that can help in this scenario.
  2. I ended up bringing up the ๐Ÿงฐ browser's dev tool to investigate the network traffic.
  3. I noticed that the traffic that I get is after the redirect happens. Alt Text
  4. I looked around the firefox dev tool and found the persist log option as shown in the picture below. This option is also available in the chrome dev tool. Alt Text
  5. Here, I saw there are a couple of domain blocked by uMatrix. Thus, I plan to allow the traffic from those domain one at a time to test which will prevent the redirect. There's around 6 sites in this case so that is doable but in hindsight enabling half at a time might be faster.
  6. I chose google-analytics.com, quantcast.mgr.consesu.org, then lastly futurecdn.net. This is how I come to the conclusion of allowing vanilla.futurecdn.net will prevent the redirect.

From my thought process in choosing which website to allow, I think what I can do better is to choose futurecdn.net as the 2nd tries. I over-analyze and chose quantcast.mgr.consesu.org because I saw the script file blocked is choice.js. Next time when I came across another similar scenario I will go for the domain that is being blocked the most first =)

Top comments (0)