app.outlit.ai. A first-party proxy sends them through a path on your own site, such as www.example.com/relay, which forwards them to Outlit. This has two effects:
- Fewer blocked events. Ad blockers that block requests to
outlit.aidon’t block events sent to your own domain. With the defaultautoTrack: "auto", the region check still goes to Outlit; see What stays direct. - Visitor IDs that last in Safari. Safari deletes cookies set by JavaScript after 7 days. Through the proxy, Outlit can set the visitor cookie from your own domain, so it lasts up to a year. That keeps a contact’s marketing-site visits, such as a return to your pricing page, linked to the person who signed in to your app.
Serve the proxy from the same host that serves your pages, as the snippets below do. Safari still applies the 7-day limit to cookies from a separate subdomain that resolves to another provider, so a CNAME such as
t.example.com pointing elsewhere blocks fewer ads but doesn’t keep visitor IDs.1. Add the rewrite
Forward/relay/api/i/v1/* on your site to https://app.outlit.ai/api/i/v1/*. Only forward that path prefix. You can use another neutral name instead of relay; avoid names like analytics or tracking, which blockers match.
- Next.js
- Vercel
- Netlify
- Cloudflare
- Nginx
- Nuxt
In If you already have a
next.config.js (or next.config.ts):rewrites() function, add this entry to the array it returns.2. Point the SDK at the proxy
Set the API host to the proxy path. The path is relative, so the same value works in every environment.- Script tag
- npm
- React
- Vue
s.dataset.publicKey=key; with s.dataset.publicKey=key;s.dataset.apiHost="/relay";.www.example.com and app.example.com. Each site needs its own rewrite.
Check that it works
- Open your site with the browser’s developer tools on the Network tab.
- Filter for
relay. After a page load or a click, you should seePOST /relay/api/i/v1/<your key>/eventswith a200or207response. If tracking is waiting for consent (see What stays direct), no request is sent until your site callsenableTracking(), so grant consent first. - Select that request. Its response headers should include
Set-Cookie: outlit_visitor_id=…; Domain=<your root domain>. That is the long-lived cookie set from your own domain.
400, make sure the site’s domain is listed under Settings → Website Visitors. The proxy forwards your page’s Origin header, and Outlit still checks it against your enabled domains. A 404 means the rewrite isn’t matching: check that the path starts with /relay/api/i/v1/.
What stays direct
With the defaultautoTrack: "auto", the SDK asks Outlit whether the visitor’s region requires consent. That check always goes to app.outlit.ai, even when you use a proxy. Outlit has to see the visitor’s own network location, not your proxy server’s. If the check is blocked, the SDK treats the region as requiring consent and waits for enableTracking(). If your site sets a Content Security Policy, allow connect-src https://app.outlit.ai for this check.
The SDK script itself still loads from cdn.outlit.ai.