Same-Origin Collector
Keep returning visitors identified on Safari and iPhone for up to 400 days by serving Atribu from a path on your own site
Serve Atribu's tracker from a path on your own website (for example yourstore.com/atb) so Safari and iPhones keep recognizing returning visitors for up to 400 days instead of 7.
Why this matters
Safari's Intelligent Tracking Prevention (ITP) deletes anything a script stores in the browser after 7 days — and after just 24 hours when the visitor arrived from an ad click. Roughly half of most stores' traffic is Safari or an in-app browser on iPhone. Without this setup, someone who clicks your ad today and buys two weeks later looks like a brand-new visitor, and the sale cannot be tied back to the ad.
A custom tracking domain (t.yourstore.com) does not fix this. It gets past ad blockers, but Safari also limits cookies set by a server on a different network from your site, and a CNAME to collect.atribu.app is exactly that.
The same-origin collector is the fix: a small proxy on your own site forwards tracking requests to Atribu, and Atribu's answer sets a secure, server-side cookie (atb_vid) that Safari leaves alone.
| Setup | Blocks ad blockers | Survives Safari's 7-day limit |
|---|---|---|
Default (atribu.app) | No | No |
| Custom tracking domain (CNAME) | Yes | No |
| Same-origin collector | Yes | Yes |
Your dashboard shows which one a profile is on under Settings > Tracking > Domains.
Setup with a Cloudflare Worker
You need your site on Cloudflare (orange-cloud proxied). Any plan works, including Free.
Save your addresses in Atribu
Go to Settings > Tracking > Domains > Same-origin collector and enter:
- Your site —
https://yourstore.com - Collector path on your site —
https://yourstore.com/atb
Click Save. Atribu shows a proxy secret once. Copy it now.
Create the Worker
In Cloudflare, open Workers & Pages > Create > Worker, name it atribu-collector, and replace its code with worker.js. Deploy.
Then, under the Worker's Settings > Variables and Secrets, add:
| Name | Type | Value |
|---|---|---|
ATRIBU_PROXY_SECRET | Secret | the secret from step 1 |
ATRIBU_PATH_PREFIX | Text | /atb (only if you chose a different path) |
Add the route
Under the Worker's Settings > Domains & Routes, add a route on your site's zone:
yourstore.com/atb/*Use the exact hostname your store is served from (www.yourstore.com/atb/* if that is your main address).
Check the installation
Back in Atribu, click Check installation. It passes when:
- the path answers through your Worker and reaches Atribu with the right secret, and
- it answers from the same network as your site (Safari's condition for keeping the cookie).
Replace your tracking code
Copy the Tracking code for this mode shown in Atribu and replace your current Atribu snippet with it. It loads the tracker from yourstore.com/atb/atribu-tracker.js.
Visitors already on your site keep their history
The first time a returning visitor reaches the new collector, their current Atribu ID becomes the long-lived one. Nobody is reset.
Command-line deploy
If you deploy Workers with Wrangler, copy wrangler.toml.example next to worker.js, replace your-shop.com, then run npx wrangler secret put ATRIBU_PROXY_SECRET and npx wrangler deploy.
Sharing the cookie across subdomains
By default the cookie belongs to the exact hostname the visitor is on. If your store spans www.yourstore.com and shop.yourstore.com, set ATRIBU_COOKIE_DOMAIN to yourstore.com in the Worker.
What the proxy sends, and what it does not
- It forwards only what the tracker needs: the event, the browser's user agent and language, the page address, and the visitor's IP address (so location and fraud checks keep working).
- It forwards only Atribu's own
atb_vidcookie. Your store's other cookies (logins, carts, sessions) never leave your site. - The proxy secret stays inside the Worker. It is never sent to browsers, and Atribu stores only a fingerprint of it.
atb_vidholds a random visitor ID — no personal data. Signing out a visitor withatribuTracker.reset()also replaces it.
For developers: the proxy contract
Any reverse proxy on your own origin can do the same job. If your site runs on Next.js / Vercel, see the dedicated recipe — a small Route Handler using @atribu/tracker/next, no Cloudflare account needed. For anything else, a proxy must:
- Serve
GET <path>/atribu-tracker.jsfromhttps://www.atribu.app/atribu-tracker.js. Optionally prependwindow.ATRIBU_TRACKING_ENDPOINT = location.origin + "<path>/api/tracking/collect";and, when the request has anatb_vidcookie,window.ATRIBU_SERVER_ANON_ID = "<its value>";. - Forward
<path>/api/tracking/*tohttps://www.atribu.app/api/tracking/*with the same method, query and body, plus these request headers:
| Header | Value |
|---|---|
x-atribu-proxy-secret | the profile's proxy secret |
x-atribu-client-ip | the visitor's IP as your edge saw it |
x-atribu-proxy-host | the hostname the browser requested |
x-atribu-proxy | <your-proxy-name>/1 |
x-atribu-cookie-domain | optional — a parent domain for atb_vid |
cookie | atb_vid=<value> only — never the site's other cookies |
- Never pass through
x-atribu-*orx-forwarded-forheaders that came from the browser. - Return Atribu's response unchanged — including its
Set-Cookie: atb_vid=…header.
Atribu trusts the forwarded IP and cookie only when the secret matches the profile the tracking key belongs to. Without it, the request is processed like any other: no cookie is set.
Next steps
Next.js / Vercel Recipe
Skip the Worker — a Route Handler does the same job
WordPress / WooCommerce Plugin
Install this as a plugin, with no code editing, and get WooCommerce cart/checkout/purchase events
Custom Domain
Get past ad blockers with a tracking subdomain
How Tracking Works
Understand visitors, sessions, and cookies