Skip to main content
Ad blockers and privacy browsers block requests by host and by URL. They block known analytics hosts, and paths that contain words such as analytics, track or collect. With a reverse proxy, the browser talks only to your own site, and your site forwards the requests to the collector.

What to proxy

The SDK sends only POST <endpoint>/v0/events. It removes one trailing / from the endpoint and appends /v0/events. So data-endpoint="https://yourdomain.com/ua" posts to https://yourdomain.com/ua/v0/events. Proxy that exact path, not the whole API. An npm install bundles the SDK, so it needs only the events path. Change your snippet to:
For npm installs, set endpoint: '/ua' or endpoint: 'https://yourdomain.com/ua'.

Choose a neutral path

Filter lists match URL substrings. Avoid /analytics.js, /track, /collect, /tracking, /stats and the collector host name. Use a short neutral prefix such as /ua, or a name from your own app. The /v0/events suffix is fixed.

Subresource Integrity

If your snippet has integrity="sha384-...", the browser checks the hash against the bytes it receives. A proxy that forwards the same pinned file unchanged keeps the same hash. It fails if the proxy points at a different or unpinned build, or changes the file. Keep crossorigin="anonymous".

Headers to forward

The collector does not read Host, so it can be any value. If the proxy drops Origin, the Publishable key and the page URL domain check still apply.

Examples

Replace https://YOUR_COLLECTOR_ENDPOINT with your collector URL and SCRIPT_URL with the src from your setup page.
The rewrite forwards the visitor IP in X-Forwarded-For. The collector looks up the country from it.

Verify

  1. Load your site with the browser developer tools open.
  2. Confirm that the script loads from /ua.js and that POST /ua/v0/events returns 202.
  3. Confirm that no request goes to the collector host or the CDN.
  4. Open Activity. Your events appear with the visitor’s country, not ZZ (unknown) or the proxy’s country.