DevTip #1: Prevent Adblock Detection For Privacy
Tags: techtip, privacy, webbrowsing, adblock
Published: 2021-02-07 10:30:10

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](https://dev-to-uploads.s3.amazonaws.com/i/2pwkw71voyqlhzkizp0d.gif)

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](#solution) followed by 🔷[the methodology](#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 <a name="solution"></a>
My solution is to use a browser extension called uMatrix ([Github](https://github.com/gorhill/uMatrix), [Chrome store](https://chrome.google.com/webstore/detail/umatrix/ogfcmafjalglgifnmanfmnieipoejdcf), [Firefox addon](https://addons.mozilla.org/en-US/firefox/addon/umatrix/)). It is noted that this extension is [no longer in active development since Sept 2020](https://www.wilderssecurity.com/threads/umatrix-development-has-ended.432663/), 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
```
or
```
specific.siteurl.com vanilla.futurecdn.net script allow
```
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](https://dev-to-uploads.s3.amazonaws.com/i/4ret0kpmix7lxc7i64tc.gif)

### 🔷 Methodology <a name="methodology"></a>

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](https://dev-to-uploads.s3.amazonaws.com/i/wi00a2tbr9dqga6co3nr.png)
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](https://dev-to-uploads.s3.amazonaws.com/i/uxkj8b05i6cx6s8o4imp.png)
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 =)