Proxy Setup
Improve tracking accuracy by proxying the SDK through your own domain.
Proxy Setup
Proxying the EngageTrack SDK through your own domain improves tracking accuracy by preventing ad blockers from blocking the tracking script and API requests.
Why Use a Proxy
- Ad blocker bypass — Ad blockers maintain lists of known analytics domains. Serving the script from your own domain avoids these lists entirely.
- First-party context — Requests to your own domain are treated as first-party by browsers, avoiding third-party restrictions.
- Privacy compliance — Data stays within your infrastructure before being forwarded, which can simplify GDPR data processing documentation.
How It Works
A proxy setup involves two things:
- Serve the SDK script from your domain instead of
cdn.engagetrack.net - Relay event data from your domain to the EngageTrack API at
api.engagetrack.net
The visitor's browser only ever communicates with your domain. Your server forwards the requests to EngageTrack behind the scenes.
Browser → yourdomain.com/js/script.js → cdn.engagetrack.net/sdk.js
Browser → yourdomain.com/api/event → api.engagetrack.net/api/v1/event
Updated Script Tag
After setting up the proxy, update your script tag to use your proxy URLs:
<script
defer
data-site-id="YOUR_SITE_ID"
data-api="https://yourdomain.com/api/event"
src="https://yourdomain.com/js/script.js"
></script>The data-api attribute tells the SDK to send events to your proxy endpoint instead of the default EngageTrack API.
Make sure your proxy forwards the original client IP address in the
X-Forwarded-For header. EngageTrack uses IP geolocation for country-level
analytics. Without the real IP, all visitors will appear to come from your
server's location.
Proxy Guides
Choose the guide that matches your stack:
- Next.js Proxy — Using rewrites or middleware
- Nginx Proxy — Reverse proxy configuration
- Express.js Proxy — Node.js middleware
The proxy approach works with any server that can forward HTTP requests. The guides above cover the most common setups. The pattern is always the same: proxy the script file and the event endpoint.