How is it calculated?
The browser compares the cookie’s domain with the site in the address bar. On shop.example, a cookie for shop.example or a subdomain of it is first-party, whoever’s script wrote it. That last point matters: an analytics or ad script running on your page can write a first-party cookie, and it then works across visits to your site but not across other sites.
First-party is not the same as exempt from consent. In the EU the ePrivacy rule asks whether storing the cookie is strictly necessary for a service the visitor asked for, not who set it: a login or cart cookie usually is, an analytics cookie usually is not. Browsers also limit some first-party cookies. WebKit’s tracking prevention documentation says Safari deletes cookies created in JavaScript, and other script-writable storage such as localStorage, after 7 days without user interaction with the site.
Example
An analytics script writes _id=93a1 as a first-party cookie on your domain with a 2-year expiry. A Chrome visitor who comes back after 30 days is counted as returning. A Safari visitor who comes back after 30 days with no visit in between has had the cookie deleted after 7 days, so the same script counts them as new. Over a quarter, the tool reports a lower share of returning visitors in Safari than in Chrome for the same audience.
Common mistakes
- Assuming first-party cookies never need consent. Under EU ePrivacy rules what matters is whether the cookie is strictly necessary, not whose domain it is on.
- Trusting long expiry dates. Safari caps script-set cookies, so a 2-year cookie may last 7 days.
- Calling a third-party tool’s cookie first-party data and stopping there. If the vendor reads it to build profiles across its customers, it is used for tracking all the same.