Atribu
Tracking

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.

SetupBlocks ad blockersSurvives Safari's 7-day limit
Default (atribu.app)NoNo
Custom tracking domain (CNAME)YesNo
Same-origin collectorYesYes

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 sitehttps://yourstore.com
  • Collector path on your sitehttps://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:

NameTypeValue
ATRIBU_PROXY_SECRETSecretthe secret from step 1
ATRIBU_PATH_PREFIXText/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.

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_vid cookie. 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_vid holds a random visitor ID — no personal data. Signing out a visitor with atribuTracker.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:

  1. Serve GET <path>/atribu-tracker.js from https://www.atribu.app/atribu-tracker.js. Optionally prepend window.ATRIBU_TRACKING_ENDPOINT = location.origin + "<path>/api/tracking/collect"; and, when the request has an atb_vid cookie, window.ATRIBU_SERVER_ANON_ID = "<its value>";.
  2. Forward <path>/api/tracking/* to https://www.atribu.app/api/tracking/* with the same method, query and body, plus these request headers:
HeaderValue
x-atribu-proxy-secretthe profile's proxy secret
x-atribu-client-ipthe visitor's IP as your edge saw it
x-atribu-proxy-hostthe hostname the browser requested
x-atribu-proxy<your-proxy-name>/1
x-atribu-cookie-domainoptional — a parent domain for atb_vid
cookieatb_vid=<value> only — never the site's other cookies
  1. Never pass through x-atribu-* or x-forwarded-for headers that came from the browser.
  2. 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

On this page