Block ads or fix broken sites
This FAQ is written in the context of finding out how to block an ad that isn't blocked automatically, but the same steps can be used to troubleshoot issues with sites that don't function properly. An example is that sometimes certain payment gateways try to collect metrics on the sale, but these domains are blocked by Pi-hole, so the payment cannot be processed. Also, some links send you through several referrers and if one of them is blocked, you may land on a blank page instead of the site you meant to go to.
Pi-hole blocks many ads, but not all of them
Pi-hole sources its ad domains from third parties (blocklists), so you may run into an advertisement that is not part of one of those lists. You can easily add a domain to the blacklist using the pihole -b
command, or via the Web interface. In order to do this, you need to find out where the ad is being served from.
Tools To Use
The Pi-hole Query Log
You can view the log in real time as it happens using pihole -t
. Run this command while you browse to the site that is showing ads. As the page loads up, watch the output in your terminal to track down what domains are being queried.
The same information is also available in the Web interface.
Adam:ONE Assistant (formery DNSThingy)
This Chrome extension will list all of the domains that are queried when a Web page is loaded. You can often look at the list of domains and cherry pick the ones that appear to be ad-serving domains. If nothing else, this can help narrow down the search.
Chrome's Inspector
To find the exact domain an ad is served from, you can use the developer tools built into Chrome. Just right click an advertisement and choose inspect.
This will open a split screen view, that lets you see the Web page's information, including what we are interested in finding, the domain name the advertisement is coming from.
Once you find this domain, just add it to your blacklist.
Difficult Ads
Some Websites self-host their ads, making them difficult to block with Pi-hole because if you block that domain, the site you are trying to get to won't load. But often, Websites will use an advertising network such as Google Ads, so the advertising content is hosted from Google's servers instead of the site the ad is being displayed on.