Uncategorized

How to Keep Cookies Alive in Safari (ITP) with Server-Side Tracking

If a big share of your traffic is on iPhone, this one matters. Safari’s Intelligent Tracking Prevention (ITP) cuts the life of many tracking cookies down to as little as 7 days, and sometimes 24 hours. So a customer who clicks your ad on Monday and buys the next week can look like a brand new visitor. Your ad platform loses the credit.

Why a simple subdomain is not always enough

A custom subdomain (Blog 1) gives you first-party cookies. But Safari also looks at the IP address. If ss.yourstore.com points to a different server IP than yourstore.com, Safari can still treat those cookies as short-lived. That is the gap these fixes close.

Your three options

OptionHow it worksEffort
Same originTracking runs on yourstore.com/metrics, same domain and IP as the siteHigh: needs Cloudflare or nginx rules
Own CDNRoute your tracking subdomain through the same CDN as your website so IPs matchMedium
Cookie Keeper (Stape power-up)Stores key cookies and restores them when Safari deletes themLow: switch it on

Step by step: Cookie Keeper (the easy path)

  1. Open your container on Stape → Power-ups → Cookie Keeper.
  2. Turn it on and choose which cookies to protect. Start with _ga, _fbp, _fbc, _gcl_aw and _ttp.
  3. Pick a storage method. Follow Stape’s recommendation for your setup.
  4. Publish and test in Safari. Visit the site, note your _ga value, come back later and check it stayed the same.

Step by step: Same origin (the strongest path)

  1. Choose a path, for example /metrics.
  2. In Cloudflare, create a rule that sends yourstore.com/metrics/* to your Stape custom domain, with the right Host header.
  3. Or in nginx, add a location /metrics block that proxies to your sGTM domain.
  4. Set the same origin path in Stape so GA4 requests work correctly.
  5. Update server_container_url in your Google tag to https://yourstore.com/metrics.
  6. Test that requests return 200 and cookies are set on your main domain.

Mistakes to avoid

  • Assuming the subdomain alone fixes Safari. It helps, but not fully.
  • Using Own CDN with same origin. Stape advises against combining them. Pick one approach.
  • Path mismatch. The page and server_container_url must use the exact same hostname and path.
  • Not checking consent. Longer cookies still need the user’s consent where law requires it.

Why clients notice

A pattern I see with stores whose traffic is mostly mobile: returning-customer numbers look oddly low in GA4, and Meta attribution windows feel “short”. After fixing cookie life, returning users are recognised again and attribution looks more like reality.

Bottom line

If you cannot do same origin, switch on Cookie Keeper. Either way, do not leave Safari users on 7-day cookies.

Source reading: Stape — a new way to set up a custom domain, Stape — same origin approach

Leave a Reply

Your email address will not be published. Required fields are marked *