Simple ad and trackers blocking with DNS

by Christian Fei @ 2019-08-26

59 words, 1 minute reading time

#post #tutorial #featured 

You can use your hosts file to redirect all traffic in a local black hole (namely 0.0.0.0)

sudo vi /etc/hosts

Add the following lines (plus hosts you find out by yourself) to /etc/hosts and save it:

0.0.0.0 google-analytics.com
0.0.0.0 www.google-analytics.com
0.0.0.0 googletagmanager.com
0.0.0.0 www.googletagmanager.com
0.0.0.0 hn.inspectlet.com
0.0.0.0 api.segment.io

if you check the network tab in your browser, you will see something like this:

block

FEEDBACK @christian_fei

Featured blog posts

Twitter oauth by example in node.js So long, and thanks for all the veggies Simplest vanilla javascript static site blog search for jekyll, hugo, 11.ty Minimal environments with dotenv and node.js Connect to mongodb with monk in node.js Lazy loading images in 2020 Recover from failed `lerna` publish The cleanest way to maintain connect / express middlewares in node.js Better web scraping with node.js My blogging stack in 2020