Custom Domain

Proxy the EngageTrack script through your own domain to bypass ad blockers and maximize tracking accuracy.

Custom Domain

Some ad blockers block third-party analytics scripts by matching known CDN hostnames like cdn.engagetrack.net. Proxying the EngageTrack script through your own domain makes it a first-party resource — ad blockers typically allow first-party traffic.

Custom domain proxying is available on the Agency plan only. Upgrade at Settings → Billing to access this feature.

Proxying through a custom domain can improve data accuracy by 10–20% depending on your audience's ad blocker usage rate.

How It Works

Without a proxy, your visitors load the script directly from EngageTrack's CDN:

https://cdn.engagetrack.net/sdk.js

With a custom domain proxy, the script loads from your own subdomain:

https://analytics.yourdomain.com/js/sdk.js

Your server or CDN forwards those requests to EngageTrack's origin. From the browser's perspective, all traffic stays on your domain — so ad blockers have no hostname to block.

Setup Options

Choose the approach that matches your infrastructure.

Nginx Reverse Proxy

Add a location block to your Nginx configuration:

location /js/ {
    proxy_pass https://cdn.engagetrack.net/;
    proxy_set_header Host cdn.engagetrack.net;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_buffering on;
}
 
location /api/event {
    proxy_pass https://api.engagetrack.net/event;
    proxy_set_header Host api.engagetrack.net;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Reload Nginx after saving: nginx -s reload.

Cloudflare Workers

Deploy a Worker that forwards requests to EngageTrack's origin:

addEventListener("fetch", (event) => {
	event.respondWith(handleRequest(event.request));
});
 
async function handleRequest(request) {
	const url = new URL(request.url);
 
	if (url.pathname.startsWith("/js/")) {
		const origin = "https://cdn.engagetrack.net" + url.pathname.replace("/js", "");
		return fetch(origin, request);
	}
 
	if (url.pathname === "/api/event") {
		return fetch("https://api.engagetrack.net/event", request);
	}
 
	return new Response("Not found", { status: 404 });
}

Deploy via the Cloudflare dashboard or wrangler publish.

Vercel Rewrites

Add a rewrites entry to your vercel.json:

{
	"rewrites": [
		{
			"source": "/proxy/sdk.js",
			"destination": "https://cdn.engagetrack.net/sdk.js"
		},
		{
			"source": "/proxy/event",
			"destination": "https://api.engagetrack.net/event"
		}
	]
}

Netlify Redirects

Add proxy rules to your _redirects file:

/proxy/sdk.js  https://cdn.engagetrack.net/sdk.js  200!
/proxy/event   https://api.engagetrack.net/event    200!

The 200! status tells Netlify to proxy the request rather than issue a redirect.

Update Your Tracking Script

Once your proxy is live, point the tracking script at your custom domain using the data-api attribute:

<script
	defer
	data-site-id="YOUR_SITE_PUBLIC_ID"
	data-api="https://analytics.yourdomain.com"
	src="https://analytics.yourdomain.com/js/sdk.js"
></script>

Replace YOUR_SITE_PUBLIC_ID with your actual site ID from the EngageTrack dashboard, and replace analytics.yourdomain.com with your actual proxy subdomain.

Verify It Works

  1. Open your browser's DevTools and switch to the Network tab.
  2. Reload the page.
  3. Confirm that sdk.js is loaded from your custom domain — not from cdn.engagetrack.net.
  4. Perform an action that triggers an event (e.g., navigate to another page) and confirm the event request goes to analytics.yourdomain.com/api/event.

Add data-debug="true" to the script tag to enable console logging. This shows you exactly which endpoint each event is sent to, which is useful for verifying your proxy setup.

Trade-offs

Proxying adds a network hop between your server and EngageTrack's API. For most setups this is negligible, but keep in mind:

  • Latency: Requests pass through your infrastructure before reaching EngageTrack. Use a geographically distributed edge (Cloudflare Workers, Vercel Edge) to minimise added latency.
  • Bandwidth: Your proxy handles script and event traffic. At high volumes this may count against your hosting bandwidth quota.
  • Maintenance: If EngageTrack changes its CDN or API endpoints, you will need to update your proxy configuration.

Next Steps

  • Return to Getting Started for the full list of data-* configuration attributes including data-api.
  • See the Configuration Options table in Getting Started for all supported script attributes.