Ad blockers and analytics: using a first-party proxy
Ad blockers can stop an analytics script from loading, so some of your visitors never appear in your reports. Serving the script and its events through your own domain, a first-party proxy, makes your tracker look like part of your site and can recover a share of that traffic.
Ad blocker on
First-party proxy
Fig.Why serving the script from your own domain changes what you can count. Sample data, not a real site.
Why do ad blockers hide visitors from analytics?
Most blockers work from lists of known tracker domains and URL patterns. When your page asks for a script from a well-known third-party analytics domain, the blocker can refuse the request, so the script never runs and the visit is never counted.
The visitor still browses your site, and if they buy, your payment provider still records the sale. The result is a gap you may notice: sales that cannot be tied to a visit, or revenue from a source your traffic charts barely show.
The size of the gap depends on your audience and we cannot give you a figure for your site, so measure it (see below). Technical audiences may well use blockers more, but check that against your own data rather than assuming it.
What is a first-party proxy?
Blocklists target third-party analytics domains. If the script and the events go through your own domain, they look like the rest of your site.
So instead of the browser calling the analytics provider directly, it calls a path on your domain, such as /js/script.js for the script and /api/events for events. A small piece of code on your domain forwards those requests to your analytics install and returns the answer.
For Ownlytics on Cloudflare, you add a short function to your site's Worker. It does these things, per the proxy docs:
- serves the script from
/js/script.json your own domain, cached for an hour, - forwards
POST /api/eventsto your Ownlytics URL, - strips cookies so your own cookies never leave your domain,
- passes the real visitor IP, user agent and location through a per-website token, so geography stays accurate.
Then you load the script from /js/script.js on your domain. The setup page fills in your URL and token. The token works only for that one website.
Who can use it?
The documented setup is for sites that run on Cloudflare Workers. If your site runs elsewhere, the same idea (forward a path on your domain to your analytics) can be built with your own server or host's rewrite rules, but we do not have a ready-made recipe for every platform, so check your host's documentation. The tracking script guide lists where to paste the tag for common platforms, and mentions the proxy for Cloudflare sites.
Example (made-up numbers for illustration)
Suppose a developer tools site has 10,000 real visits a month, and 18% of visitors use a blocker.
| Setup | Visits recorded | Missing |
|---|---|---|
| Third-party script, blocker users hidden | about 8,200 | about 1,800 |
| First-party proxy, blockers no longer match | closer to 10,000 | fewer, but not zero |
The numbers are invented. What matters is the direction: you would see more visits and, more usefully, fewer sales that arrive without a visit. If your proxy recovers only half the hidden visitors, that is still a better picture of where buyers came from.
How can you check how much you are missing?
Do not guess. Run this checklist:
- Compare sales to visits. Count sales over the last 30 days. Count how many your attribution could link to a visit, see sources and attribution. A large unlinked share is a hint of blocked scripts, though other causes exist.
- Test with a blocker. Open your site in a browser with a common blocker on, and watch your realtime view. If your visit does not show, the script is being blocked.
- Set up the proxy. Load the script from your own domain.
- Test again. Repeat step 2 and check that the visit now appears.
- Wait two weeks. Compare the sales-linked share to before.
Fig.Sources counted after the first-party proxy. Sample data, not a real site.
What are the limits?
A proxy is not a cure.
- Some blockers also match URL patterns. A path that looks like
/api/eventsor a script name can still be matched by broader rules. Your results will vary by blocker. - People can turn off JavaScript entirely. No script-based tracker sees them.
- It adds a moving part. Your Worker now sits between visitors and analytics. If it breaks, events stop. Test after changes.
- Some visitors want to be left out. Respect that. A proxy is about reliable measurement of people who have not opted out through their own tools; it is not meant to defeat a visitor's deliberate choice to avoid tracking. How your setup fits privacy rules is a question for your own counsel, and we cover the basics in cookieless analytics and GDPR.
When this doesn't apply
If your audience rarely uses blockers, or you have only a few visits a day, the gain will be small and not worth a deploy. If your goal is revenue, remember that sales also reach Ownlytics from your payment provider, so revenue totals do not depend on the script. What the proxy protects is the link from sale to source.
Also remember that fake visits are the opposite problem. Our post on bot and referrer spam covers filtering them.
At a glance
| Question | Answer |
|---|---|
| What does the proxy change? | Script and events load from your domain |
| What does it need? | A Cloudflare Worker (documented setup) |
| Does it fix every blocker? | No |
| Does it change revenue totals? | No, only visit coverage and linking |
| Do your cookies leave your domain? | No, the proxy removes them from forwarded requests |
Try it
The proxy setup is covered in the docs, and plans for self-hosted and hosted are on the pricing page.
FAQ
Will a proxy get all my blocked traffic back?
No. It helps against domain-based blocking but not against every pattern or against visitors with JavaScript off. Treat it as recovering a share, and measure the change.
Does the proxy hide data from my visitors or from me?
Neither. It only changes the path the requests take. Your analytics receives the same events, with accurate location and IP passed through your token.
Do I need a proxy if I only care about revenue?
Not for revenue totals, which come from your payment provider. The proxy helps most with linking sales to the visits and sources that produced them.
Is using a proxy allowed under privacy law?
Rules depend on what you collect and where you operate. This is general information, not legal advice, so ask your own counsel or regulator.