First-Party Cookies
By the AdFlint research team · Last reviewed November 2026
Set by the domain a visitor is actually on, readable only by that site, and used for sessions, carts, and measurement.
The browser stores them against your own domain, so they survive the third-party blocking that Safari applies by default. Advertisers depend on them for session continuity and for holding click identifiers like the gclid. The limit people miss is lifespan: WebKit says Safari deletes cookies created in JavaScript after 7 days without user interaction, which is why server-set cookies and server-side tagging exist.
Key takeaways
- A first-party cookie is written by the site the visitor is on and readable only by that site.
- Safari blocks third-party cookies by default but still keeps first-party ones, with shorter life for script-written cookies.
- Click identifiers like the gclid usually live in first-party cookies, so expiry affects attribution.
- Check Safari versus Chrome conversion counts to see whether cookie expiry is costing you credit.
In practice.
A first-party cookie is a small text file that a website saves in a visitor's browser, written by the same domain the visitor is on. If someone browses yourshop.com, a cookie from yourshop.com is first-party. Only that domain can read it back on later visits. Sites use them for things people expect to work: staying logged in, keeping items in a cart, remembering a language choice, and counting a returning visitor as one person across several sessions. Analytics and ad tags that run on your own domain write them too. A second common first-party cookie holds a session or visitor ID that your analytics tool uses to stitch pageviews into a visit, and a consent cookie that remembers what the visitor accepted in your banner.
Browsers treat first-party cookies far more kindly than third-party ones, because the user is deliberately visiting that site. Safari's Intelligent Tracking Prevention blocks all third-party cookies by default, according to WebKit's tracking prevention page, but it does not block first-party cookies outright. What they limit is lifespan. WebKit says cookies created with JavaScript are deleted after 7 days without the user interacting with the site, and server-set cookies are capped at 7 days only when Safari detects CNAME or IP cloaking by a third party. A cookie from your own server is treated better than one a script writes. The details differ by browser, and the rules change with new versions, so test on the browsers your customers actually use instead of relying on a general rule of thumb.
In advertising, first-party cookies hold the identifiers that link a click to a later action. When someone clicks a Google ad with auto-tagging on, a click ID called the gclid appears in the landing URL, and a tag stores it in a first-party cookie so a purchase days later can still be matched to the click. Meta's pixel works the same way with its own click and browser identifiers. That is why the cookie's expiry date matters: if Safari deletes it after seven days of inactivity, a buyer who returns on day ten looks like a brand-new visitor and the ad gets no credit. Ad platforms have built features around this. Google's auto-tagging adds a click ID to the URL, and enhanced conversions pass hashed customer details to help match when a cookie is missing or has expired.
People run into three recurring problems. The first is assuming first-party means durable, when a cookie written by JavaScript can be cut short on Safari. The second is a cookie banner that blocks the tag until consent, which means measurement starts late or not at all for visitors who ignore the banner. The third is placing tags on a different domain from your checkout, such as a payment or booking subdomain, so the identifier is lost at the very step you want to measure. Cross-domain linking settings in your analytics tool exist to fix that last one. Server-side tagging is the fix many teams reach for: your own server sets the cookie, and it can last longer than one written by a script in the page. It costs hosting money and setup time, so it fits larger budgets first.
To check yours, open your browser's developer tools, find the Application tab, and look at the cookies listed under your own domain. Note the names and expiry dates of the ones your ad and analytics tags set. Then compare Safari conversions with Chrome conversions in your reports. A large gap suggests cookies are expiring early. This week, confirm your consent banner behaves correctly, test a purchase across your checkout domain, and ask whoever manages your tags whether a server-side setup is worth the cost at your volume. Keep a short log of your cookies, their purpose, and lifespans, which also helps with privacy disclosures.
A roofing company loses Safari leads
Say a roofing company spends $2,000 a month on Google Search ads and books quotes by phone and web form. Its tag stores the click ID in a script-written cookie. Many homeowners click the ad on a phone, then take two weeks to compare quotes before calling or submitting a form.
In reporting, Chrome shows 24 form leads and iPhone traffic shows only 6, although the click split is nearly even. The owner sets the click ID in a server-side cookie instead, and the next month iPhone leads rise to 15 reported. The company did not get more leads. The same leads now show up in the data, so the reported cost per lead across the account drops from about $67 (30 leads) to about $51 (39 leads). The takeaway is that the same spend produced the same leads either way; only the record keeping changed, and bidding systems learn better from complete records.
First-Party Cookies compared with
The settings this gets confused with, and how to tell them apart.
Common questions.
What is the difference between first-party and third-party cookies?
A first-party cookie is set by the domain you are visiting and read only by that domain. A third-party cookie is set by a different domain, such as an ad network, through a script embedded in the page, and can follow a browser across unrelated sites.
Do first-party cookies expire in Safari?
Yes, in some cases. WebKit states that cookies created in JavaScript are deleted after 7 days without user interaction with the site. Cookies set by your server in an HTTP response are capped at 7 days only when Safari detects third-party CNAME or IP address cloaking.
Do I need consent for first-party cookies?
In many places, yes for non-essential ones, including analytics and advertising cookies, regardless of who sets them. Strictly necessary cookies, like a shopping cart, are usually treated differently. Rules vary by country, so check with a qualified adviser for your market.
How do I see first-party cookies on my site?
Open your browser developer tools, go to the Application tab (Storage in Firefox), and expand Cookies under your own domain. You will see each cookie's name, value, expiry, and whether it was set by script or by the server.
Sources
- Tracking Prevention in WebKit, WebKit, checked Nov 4, 2026
You should not need to know this to advertise.
AdFlint handles the settings for you, inside the Google and Meta accounts you already own.
Next step: How AdFlint tracks and optimizes these numbers
Try AdFlint free