Documentation
Ad-blocker bypass (proxy)
Route the beacon through your own domain so ad blockers treat it as a first-party request.
By routing analytics through your application's own domain, standard uBlock Origin heuristics treat the data endpoints as legitimate first-party resource calls and won't block the payloads.
Only the beacon (the data-host endpoint) needs proxying. That's what filter lists target. Add one wildcard rewrite, then point each script's data-host at the proxied path. The script files themselves load from our CDN as normal.
Next.js / Vercel
next.config.ts
module.exports = {
async rewrites() {
return [
{
source: '/api/jamp/:path*',
destination: 'https://www.jamp.io/api/:path*',
},
]
},
}Then point each script's data-host at the proxied route. The src stays on our domain:
index.html
<script defer data-website-id="YOUR_WEBSITE_ID" data-host="/api/jamp/event" src="https://www.jamp.io/main.js"></script>
<script defer data-website-id="YOUR_WEBSITE_ID" data-host="/api/jamp/perf" src="https://www.jamp.io/app.js"></script>
<script defer data-website-id="YOUR_WEBSITE_ID" data-host="/api/jamp/diag" src="https://www.jamp.io/index.js"></script>Nginx
nginx.conf
location /api/jamp/ {
proxy_pass https://www.jamp.io/api/;
proxy_set_header Host www.jamp.io;
proxy_set_header X-Forwarded-For $remote_addr;
}Cloudflare Workers
worker.js
export default {
async fetch(request) {
const url = new URL(request.url)
if (url.pathname.startsWith('/api/jamp/')) {
const target = 'https://www.jamp.io' + url.pathname.replace('/api/jamp', '/api')
return fetch(target, request)
}
return fetch(request)
}
}