Pi-hole’s statistics page is a treasure trove of information, but its most surprising truth is that raw block counts are a terrible metric for measuring ad blocking effectiveness.
Let’s look at a real Pi-hole in action. Imagine a typical home network. We’ve got a few devices: a laptop, a smartphone, and a smart TV.
Here’s a snippet of what the query.log might look like during a short period of browsing and streaming:
2023-10-27 10:00:01 query[A] google.com 192.168.1.100
2023-10-27 10:00:02 reply google.com is 142.250.184.46
2023-10-27 10:00:05 query[A] ads.doubleclick.net 192.168.1.100
2023-10-27 10:00:05 reply ads.doubleclick.net is 0.0.0.0#0 (CNAME adserver.google.com)
2023-10-27 10:00:06 query[A] www.youtube.com 192.168.1.102
2023-10-27 10:00:07 reply www.youtube.com is 142.250.184.46
2023-10-27 10:00:10 query[A] static.ads-a.com 192.168.1.101
2023-10-27 10:00:10 reply static.ads-a.com is 0.0.0.0#0 (NXDOMAIN)
2023-10-27 10:00:15 query[A] example.com 192.168.1.100
2023-10-27 10:00:16 reply example.com is 93.184.216.34
In this log, we see ads.doubleclick.net and static.ads-a.com being blocked. The Pi-hole’s statistics page will increment its "Blocked Queries" counter for these. It will also show "Total Queries" for google.com, www.youtube.com, and example.com.
The core problem Pi-hole solves is the barrage of tracking and advertising domains that plague modern internet usage. By acting as a DNS sinkhole, it intercepts these requests before they reach your devices and resolves them to an invalid IP address (0.0.0.0 or NXDOMAIN), effectively preventing the ad or tracker from loading.
The "Stats" page in Pi-hole provides several key metrics:
- Total Queries: Every DNS request your network makes, whether allowed or blocked.
- Unique Domains: The number of distinct domain names queried.
- Queries Blocked: The number of DNS requests that matched a domain in your blocklists.
- Percentage Blocked: Queries Blocked / Total Queries.
This percentage is your primary indicator of effectiveness. A higher percentage means Pi-hole is intercepting more unwanted requests. You can drill down into "Top Blocked" and "Top Permitted" domains to see what is being blocked and what is still getting through. This helps you refine your blocklists.
The "Top Permitted Domains" are crucial. If you see a lot of ad-serving domains here, it means your blocklists aren’t comprehensive enough, or the ads are being served from domains not yet on any list. You can copy these domains and add them to a custom blocklist.
The "Top Blocked Domains" shows you which advertising networks are most active on your network. This is useful for understanding your personal threat landscape.
The most effective way to improve your blocking is not by adding millions of obscure domains, but by focusing on the types of domains that are getting through. For example, if you see many subdomains of adservice.google.com being permitted, you might add adservice.google.com to your blocklist.
The real power comes from understanding the ratio of blocked to permitted queries. A high total query count with a low percentage blocked is a sign that your blocklists are insufficient for your network’s activity. Conversely, a high percentage blocked on a low total query count might indicate that your network isn’t very active, or that the majority of its traffic is already well-filtered.
The "Advertisers" and "Trackers" sections on the stats page are derived from the "Top Blocked Domains" list, aggregated by a pre-defined mapping of domains to categories. This is a convenient way to see the types of unwanted content being blocked.
The most effective way to analyze your ad blocking effectiveness isn’t by looking at the absolute number of blocked queries, but by examining the percentage of queries that are blocked relative to the total queries. This gives you a normalized view of how well your Pi-hole is performing against the actual DNS traffic on your network. If your percentage blocked is low, it means a significant portion of your DNS requests are for domains that are not on your blocklists, and therefore ads or trackers associated with those domains are likely being served.
Understanding the relationship between blocklists, query types, and the resulting percentage blocked is key to optimizing your Pi-hole.