Why a first-party cookie forgets you
A first-party cookie written by JavaScript can still disappear after about a week in Safari. Here is how that differs from a cookie set by the server, what it does to a client id, and how the cookies lab shows it.
"First-party" names the cookie jar. In Safari, a cookie JavaScript wrote on your own site can be gone after about a week away, and the next hit starts a new client id.
The cookies lab lists every cookie and storage key on this origin: owner, purpose, lifetime. Open it in Safari and in Chrome. The rows can match. A week later, they will not.
Two ways to write a cookie
Script sets a cookie by assigning document.cookie. You can add expires or max-age, plus path, domain, secure, and samesite. You cannot mark it HttpOnly, and other script on that origin can read the value.
The server sets one with Set-Cookie. MDN says HttpOnly forbids JavaScript from reading the cookie. The browser still sends it later. ITP 2.1 states the same limit: a cookie created through document.cookie cannot be HttpOnly.
Seven days, and one shorter case
ITP 2.1 caps a persistent document.cookie cookie at seven days, on a first-party page and in a third-party iframe. A session cookie stays a session cookie. A shorter expiry is kept.
WebKit's tracking-prevention page says ITP now deletes JavaScript-created cookies and other script-writable storage after 7 days with no click, tap, or typing. Scrolling does not count.
Link decoration is the one-day case. ITP 2.2 applies it when a classified cross-site tracker navigated in and the landing URL has a query string or a fragment. The current page calls that 24 hours, on that page only.
CNAME cloaking is seven days, on Set-Cookie. WebKit caps cookies from a subdomain whose CNAME differs from the site and from the top frame's own CNAME. An edge host in front of the site is not that case. The tracking-prevention page caps IP-address cloaking at 7 days.
The client id
Google's cookie page: the GA4 tags use first-party cookies. _ga distinguishes users. _ga_ plus the container id persists session state. Both default to 2 years. No return visit means at most 400 days in Chrome and 7 in Safari.
cookie_expires is 63072000 seconds and refreshes each hit while cookie_update is true. Safari still caps the write. A week away, the id is new, and returning-visitor and attribution numbers restart. Rules do not read _ga. See From a push to a Google hit and When the Google tag never arrives.
localStorage
MDN: localStorage has no expiry, and sessionStorage ends with the page session. WebKit, March 2020, still deletes both, plus IndexedDB, media keys, and service workers, after seven days of Safari use without interaction. The rules read site.visitor.v1, the record behind Personalization from the same signals. Safari can drop it while bbp.visitor remains.
What the server can keep
bbp.visitor is Set-Cookie from the collect route when a beacon is stored and the cookie is missing: HttpOnly, SameSite=Lax, Path=/, Secure on https, Max-Age 400 days (34,560,000 seconds). Later beacons leave that date. Ordinary events need granted consent, and Sec-GPC: 1 is refused. The gate is What a beacon actually sends.
The seven-day cap is the document.cookie rule. This origin's response is outside it. A cloaked vendor subdomain is not, and consent still has to be granted. Since Chrome 104, Expires and Max-Age stop at 400 days for a server-set cookie too. Script cannot read bbp.visitor. The rules use site.visitor.v1.
Other browsers
Firefox Total Cookie Protection is on by default: each site has its own cookie jar. That confines a cookie to the site where it was set, which is a different control from Safari's script-cookie cap.
Chrome's 22 April 2025 update kept third-party cookie choice in Privacy and Security settings, with no new prompt. Incognito already blocks third-party cookies. The first-party date limit is 400 days.
What the lab shows
Names come from /api/cookie-inventory and from the page. Values stay hidden. A document.cookie name says "Readable by script." A server-only name says "HttpOnly — script cannot read the value." Party is the identifier's owner, so _ga says third party. Speed Insights sets none of these keys. The lifetime is the catalog's, because Max-Age is not returned. Unknown names say so.
Cookies, this site, first party:
bbp.visitor. Anonymous id forcollect_event.visitor_key. HttpOnly. 400 days, SameSite=Lax, Secure on https.bbp_experiment. HttpOnly counts already recorded, so a refresh does not double-count. 30 days, SameSite=Lax.bbp_form. HttpOnly form steps already counted. No field text. 12 hours, SameSite=Lax.bbp_blocking. HttpOnly. Blocking lab counts this browser once per 12 hours. Value1. 12 hours, SameSite=Lax.bbp.reset. Names only, after Reset my data. Removed when dismissed. 120 seconds. Not HttpOnly.bbp.track. Event name for a dataLayer push after login, sign-up, or logout, then cleared. 120 seconds.session-token. Auth.js session. Value hidden. Account id inside isuser.id. 30 days from sign-in. HttpOnly, SameSite=Lax.csrf-token. Auth.js. Pairs the sign-in form with this browser. Value hidden. Sign-in attempt. HttpOnly.callback-url. Auth.js. Return path after a magic link. Not a personalization signal. Sign-in attempt.
Google Analytics, party "Third party":
- A
_ganame. Client id and GA4 session cookie fromgtag.jsafter analytics storage is granted. Cell:_gaup to 2 years,_gidabout 24 hours,_gatabout 1 minute,_ga_<measurement id>is the session cookie. Google lists_gaand_ga_<container-id>at 2 years. Here:_ga_JDE6BF33RY. Rules skip it.
localStorage, this site, first party, until you clear site data. The value stays in this browser.
site.consent.v1.grantedordenied. Gates beacons and the dataLayer.site.consent.choice.v1. Choice, time, and version. No account id.site.visitor.v1. Visit count and topic order for the rules. Notbbp.visitor. Written only with consent.site.zero.v1. Profiling answers (role, goal, industry), until reset or a clear.site.exit.v1. Time of the last exit note. The note hides for 12 hours. The key remains until cleared.site.experiment.visitor. Experiments-lab key. Not the server visitor id.site.why.v1. Whether Why labels are on. Not written while consent is off.
sessionStorage, this site, first party. This tab. Closing the tab removes it.
site.session.v1. Pages, scroll, and dwell. The rules read it.site.path.v1. Page order on the pathing lab.site.experiment.bandit. Thompson-sampling arm, so a refresh keeps the headline.white-paper-lead:prefix. Stops a secondgenerate_leadon the thank-you page. Value1.
The storage lab shows values, sizes, and the page request's cookies, HttpOnly included. Consent off: visitor and session records are not written and do not change the page.
A consented beacon stores visitor_key from bbp.visitor with user_id null. On sign-in, claimVisitor sets Auth.js user.id on unclaimed rows for this key and skips rows that already have an account. Later beacons store both. _ga is not joined.
Try it
- In Safari, open the cookies lab, accept measurement, and reload after a beacon.
bbp.visitoris HttpOnly. If the tag ran,_gaand_ga_JDE6BF33RYare readable by script, and the cell still says up to 2 years. - Open it in Chrome. Compare the expiry each browser stored. Chrome stops at 400 days. Safari's script cookie is seven days without interaction, or one day after link decoration.
bbp.visitorcan keep the longer date. - In the storage lab, the returning-visitor line is
site.visitor.v1. In Safari it shares the script-storage timer. The server cookie can still arrive after that key is gone.
Sources
- Intelligent Tracking Prevention 2.1, WebKit
- Intelligent Tracking Prevention 2.2, WebKit
- Full Third-Party Cookie Blocking and More, WebKit
- CNAME Cloaking and Bounce Tracking Defense, WebKit
- Tracking Prevention in WebKit
- Document.cookie, MDN
- Set-Cookie, MDN
- Using HTTP cookies, MDN
- Window.localStorage, MDN
- GA4 cookie usage on websites, Google Analytics Help
- GA4 configuration fields, Google for Developers
- Cookie Expires and Max-Age upper limit, Chrome for Developers
- Next steps for Privacy Sandbox and tracking protections in Chrome
- Firefox rolls out Total Cookie Protection by default, Mozilla
Labs that show this
- Cookies, storage, and consent
Cookies, storage, and consent on this origin: who owns each key, how long it lasts, and which services are not cookies. Free, and Speed Insights sets none.
- Local storage personalization
Local storage personalization: the keys this site writes, what each one changes on the page, and how to edit or delete them. Free to inspect in this browser.
- Consent Mode and Global Privacy
Consent Mode and Global Privacy Control on this site: what is sent before Accept, what changes after, and how a GPC signal keeps measurement off.
Recommended next
Why these picksReading path transitions…