Published November 24, 2026. Browser rules in this guide come from WebKit, Mozilla and Google documentation, checked on that date. Browser behavior changes often, so recheck the linked sources before you rely on a specific limit.
The short answer
To extend cookie lifetime for attribution, set your identifiers from a server on your own domain, in the HTTP response, instead of writing them with JavaScript in the browser. Safari deletes cookies created in JavaScript after seven days without user interaction and caps cookies set through cloaked third-party servers, while Chrome caps every cookie at 400 days. Server-side tagging, first-party server-set cookies and edge identity layers such as Nostra Edge ID are the main routes, and none of them overrides consent choices or browser privacy controls.
Why do tracking cookies expire so quickly?
Because browsers now treat identifiers differently depending on who sets them and how. A cookie written by a tag with JavaScript, a cookie sent by your own server, and a cookie set by a third party all fall under different rules. For a refresher on the categories, see what first-party cookies are.
| Browser | Rule | What it affects | Source |
|---|---|---|---|
| Safari (WebKit) | Third-party cookies blocked by default | Cookies set in a third-party context | WebKit tracking prevention |
| Safari (WebKit) | Cookies created in JavaScript and other script-writeable storage are deleted after 7 days of no user interaction with the website | document.cookie identifiers, LocalStorage, IndexedDB and similar storage | WebKit tracking prevention |
| Safari (WebKit) | When a classified tracker decorates a link, cookies created in JavaScript on the landing page are capped at 24 hours | Click IDs and identifiers written by script after a tracked click | WebKit tracking prevention |
| Safari (WebKit) | CNAME and third-party IP address cloaking defense caps cookies set in the HTTP response at 7 days | Server-set cookies from a subdomain that is really a third-party host | WebKit tracking prevention |
| Firefox | State Partitioning, on by default since Firefox 103, gives embedded third parties a separate storage bucket per top-level site | Third-party cookies used across sites | MDN: State Partitioning |
| Chrome | Since Chrome 104, no cookie can expire more than 400 days after it is set; longer expirations are capped | Every persistent cookie, first or third party | Chrome for Developers |
Safari is the strictest of the three for attribution, because WebKit's rules target the way most marketing tags store identifiers: in JavaScript, on the page. A shopper who clicks an ad, browses, and comes back to buy ten days later can look like a brand-new visitor. Our guide to first-party cookies in Safari covers the settings shoppers see, and Chrome first-party cookies covers Chrome's side.
What is the difference between script-set and server-set cookies?
A script-set cookie is written in the browser, typically through document.cookie. A server-set cookie arrives in a Set-Cookie header on an HTTP response. According to MDN's Set-Cookie reference, the server can mark a cookie HttpOnly, which stops JavaScript from reading it through document.cookie, and the Domain attribute controls whether subdomains receive it.
The distinction matters because WebKit's seven-day rule applies to cookies created in JavaScript. WebKit's separate cap on cookies set in HTTP responses applies when the responding host is a cloaked third party. In WebKit's own table, requests that are not third-party cloaked get no cap. A server-set cookie still expires when its Max-Age or Expires says it does, still falls under Chrome's 400-day limit, and is still gone if the shopper clears site data.
What is CNAME cloaking, and why does it matter for server-side setups?
WebKit describes CNAME cloaking as a subresource that appears to be first party but whose DNS alias points somewhere other than the first-party domain. It also detects third-party IP address cloaking. In both cases, Safari caps the expiry of cookies set in the HTTP response at seven days. A tracking subdomain such as metrics.yourstore.com that simply aliases a vendor's servers can therefore lose the benefit you set it up for. Before you choose a setup, ask how its subdomain resolves and how that compares with WebKit's definitions.
What are the options to extend cookie lifetime?
Every option below moves identifier creation away from page JavaScript. They differ in what you have to run and who maintains it.
| Option | How the identifier is set | What it needs | Limits that still apply |
|---|---|---|---|
| Server-side tagging | A tagging server on your domain or subdomain sets cookies in its HTTP responses | A server container plus a custom domain. Google says a subdomain needs only DNS updates, while same-origin needs a CDN or load balancer | Consent, Chrome's 400-day cap, and WebKit's cloaking rules if the subdomain resolves to third-party infrastructure |
| First-party server-set cookies | Your own application server sends a Set-Cookie header, often HttpOnly | Control of the server that answers page or API requests on your domain | Consent, Chrome's 400-day cap, and users clearing site data |
| Edge identity layer | A proxy on your domain handles supported tracking requests and the identifiers they use | DNS access and a vendor that supports your tags and integrations | The same browser rules as above. Confirm how the deployment relates to WebKit's cloaking definitions |
| JavaScript cookies only (the default) | Tags write identifiers with document.cookie | Nothing extra | Safari's 7-day and 24-hour rules, plus every limit above |
Server-side tagging
Google describes server-side tagging as running a Tag Manager server container in your own cloud environment, which receives measurement data instead of the browser sending it straight to each vendor. Its custom domain guide says cookies set by the server get their security and durability benefits only when the server runs on your domain or a subdomain. On the default cloud domain, the server can only set JavaScript cookies. The guide does not address Safari's cloaking rules, so check those separately.
First-party server-set cookies
If you control the server that answers requests on your domain, it can issue its own long-lived identifier in a Set-Cookie header and keep it HttpOnly. This is the simplest version of the idea, but on hosted commerce platforms you often do not control that server directly.
Edge identity
An edge layer sits on your domain in front of the store and handles identity for supported tags. It suits teams that want a managed setup rather than running their own tagging server.
Where does Nostra Edge ID fit?
Nostra Edge ID is an edge identity option. Nostra describes it as a first-party proxy for supported tracking integrations on your own domain, powered by its cookie agent, Crumble, which acts as a server-side first-party proxy to help your marketing tools recognize returning shoppers. Nostra manages the setup. Nostra lists Meta, Google Analytics, Klaviyo, Attentive and Intelligems as integrations to confirm with its team, and says to check DNS access, supported cookies and events, and consent configuration during planning.
Nostra is also clear about limits. It says there is no universal cookie lifetime across browsers and configurations, that first-party delivery does not override browser privacy controls, and that Edge ID does not replace consent controls. Nostra recommends measuring recognition by browser and return interval against your current baseline before projecting revenue gains.
Why is my ecommerce conversion tracking inaccurate?
Usually for several reasons at once. Check these in order:
- Identifiers expire between visits. When a script-set cookie is deleted, a returning buyer looks new. The sale gets credited to the last touch or to direct traffic, and the original campaign loses the conversion.
- Consent and privacy settings. Shoppers who decline tracking, or browsers that block third-party cookies, are not measured the same way as everyone else.
- Bot sessions. Automated traffic inflates sessions and can trigger events. GA4 excludes known bots automatically but does not show how many it removed, and Shopify filters only the bots it identifies. Our guide on protecting conversion rate accuracy from bots covers this layer.
- Measurement changes. Shopify's session measurement update changed how sessions are counted: they now end after 30 minutes of inactivity instead of at midnight UTC, and sessions without a pageview now count. Conversion rate can move while orders stay the same.
- Tools disagree by design. Your store platform, GA4 and ad platforms define sessions, users and attribution windows differently. See how GA4 uses first-party cookies for one example.
- Cross-device journeys. A shopper who browses on a phone and buys on a laptop is two visitors to a cookie, whatever its lifetime.
How should you test a cookie lifetime change?
Treat cookie persistence, visitor recognition and revenue as three separate results. Measure each by browser, because Safari, Chrome and Firefox behave differently. Keep consent settings and attribution windows constant, define the returning-visitor cohort before you start, and compare against a baseline from your current setup. A longer-lived cookie is one input to measurement, not proof of incremental sales.
Frequently asked questions
How long do first-party cookies last in Safari?
It depends on how they are set. WebKit deletes cookies created in JavaScript after 7 days with no user interaction with the website, and caps them at 24 hours on a landing page reached through link decoration. Cookies set in HTTP responses from a cloaked third-party host are capped at 7 days. WebKit lists no cap for requests that are not third-party cloaked.
Does server-side tagging extend cookie lifetime?
It can, if the tagging server runs on your own domain or a subdomain. Google says that on the default cloud domain the server can only set JavaScript cookies. Consent, Chrome's 400-day cap and WebKit's cloaking rules still apply.
What is CNAME cloaking?
WebKit uses the term for a subresource that looks first party but whose DNS alias points somewhere other than the first-party domain. Safari caps cookies set in HTTP responses from cloaked third-party hosts at 7 days.
Is there a maximum cookie lifetime in Chrome?
Yes. Since Chrome 104, released in August 2022, a cookie cannot be set to expire more than 400 days in the future. Longer expirations are capped at 400 days from when the cookie was set.
Does Firefox limit first-party cookies?
Mozilla's State Partitioning, on by default since Firefox 103, applies to embedded third parties: each top-level site gets its own storage bucket. Cookies your own site sets in a first-party context are not what it targets.
Does Nostra Edge ID guarantee a longer cookie lifetime?
No. Nostra says no universal cookie lifetime applies across browsers and configurations, and that first-party delivery does not override browser privacy controls or consent. Confirm the supported lifetime for your cookies and deployment, then measure recognition against your baseline.
