While auditing 2,328 live European websites from Frankfurt on Google Consent Mode v2 (gcs/gcd transitions across Cold Load -> Reject All -> Accept All), one recurring pattern stood out:.
Sites paying for server-side Google Tag Manager (sGTM) — often hosted on Stape or Cloud Run behind a custom subdomain like sgtm.example.com or metrics.example.com — were still losing tracking hits because their custom subdomain had already landed on public CNAME-cloaking and DNS ad-blocker lists. (Related: My Journey to a serverless transformers pipeline on Goo...)
I wanted to build an instant, zero-login checker that runs entirely at the edge on Cloudflare Workers with < 5ms cold start and lookup latency, zero external DNS queries, and zero database round-trips. (Related: How to Start a Side Business While Working Full-Time...)
Here is how we packed 79,463 domains across 5 major filter lists into a compact Worker bundle.
Ad-blocker and DNS filter maintainers actively sweep CNAME-cloaked first-party tracking proxies. Merging and deduplicating the 5 most widely deployed lists (used by AdGuard, Brave, NextDNS, Pi-hole, and uBlock Origin) yields 79,463 unique indexed domains:.
(A single domain can appear in multiple lists — e.g. both adguard_cname and hagezi_multi.).
Dropping a raw JSON map of 79,463 domain strings -> list arrays into a Cloudflare Worker causes two immediate problems:.
Instead of storing an array of list names per domain, we assign each of the 5 lists a single bit (1 << 0 through 1 << 4), group domains by their 5-bit mask (1..31), sort each bucket lexicographically, and front-code adjacent entries in fixed-size blocks separated by blank lines:.
Because every block starts with one unencoded header domain, the Worker never decompresses the whole index at startup:.
Result: < 5ms cold start and lookup latency inside a standard Cloudflare Worker, with zero external API calls.
Even if a brand-latest sgtm.example.com subdomain hasn't been scraped into adguard_cname yet, filter-list maintainers regularly sweep obvious tracking prefixes. Alongside exact blocklist matching, we check subdomain labels against high-risk giveaway prefixes (sgtm, ssgtm, sst, gtm, tagging, metrics, analytics, telemetry, tracking, collect, pixel, stats) and surface a HIGH / MEDIUM / LOW heuristic risk rating.
If you're deploying server-side GTM:.
If you've run into interesting edge cases with CNAME-cloaking detection or Cloudflare Worker static-index packing, I'd love to hear how you approached it in the comments!
