Skip to content

Glossary Cookie

What Is a Cookie?

  • Analytics
Definition

An HTTP cookie is a small text file a server stores in the browser via the Set-Cookie header, so a website can remember data between separate requests even though HTTP itself has no memory of its own.

A brass cloakroom token, completely smooth — beside the title Cookie
The token says not who you are, only that you were here
On this page 6
  1. What is a cookie and how does it work technically?
  2. First-party cookies versus third-party cookies
  3. How it works: session, persistent, and the SameSite attribute
  4. Why it matters: consent, GDPR, and the browsers' back-and-forth
  5. Best practices
  6. Common mistakes
In brief

What a cookie actually is, how first-party cookies differ from third-party ones, when consent is legally required, and what Chrome, Safari, and Firefox really changed in 2025 and 2026.

A brass cloakroom token, completely smooth — beside the title Cookie
The token says not who you are, only that you were here

First-party cookies versus third-party cookies

AspectFirst-party cookieThird-party cookie
Who sets itThe domain you're actually visitingA different domain, loaded inside the page via an ad, widget, or pixel
Typical useSession, cart, language, first-party analyticsCross-site advertising, retargeting, cross-domain measurement
Status in 2026Unrestricted in every browserBlocked by default in Safari since 2020 and Firefox since 2019; Chrome confirmed in April 2025 it would keep them

The line between the two has nothing to do with what the cookie stores. It comes down to who sets it and from which domain it's served. The same analytics vendor can run as a first-party cookie when configured on the site's own domain, or as a third-party cookie when its script loads directly from the vendor's domain.

How it works: session, persistent, and the SameSite attribute

A session cookie carries no expiration date: it lives only while the browser stays open and disappears once you close it. It's what keeps a half-filled form or an active login intact. A persistent cookie, by contrast, carries an Expires or Max-Age attribute and survives for days, months, or years, until that date arrives or the user clears it manually.

The SameSite attribute decides whether a cookie also travels on requests coming from another domain. With Strict, it only goes out on requests that originate from the site itself; with Lax, the default in most modern browsers, it's also sent when the user navigates directly to the page; with None, it travels in any context, but requires the Secure attribute and an HTTPS connection. This control exists as a direct response to CSRF attacks, where a malicious site exploited the fact that browsers sent another site's session cookie along without the user noticing.

Alongside SameSite, two more attributes close the gap: HttpOnly stops JavaScript from reading the cookie in the browser, and Secure forces it to travel only over HTTPS. When a third-party cookie gets blocked, some advertisers fall back on alternatives such as the tracking pixel or fingerprinting, each with its own technical and legal limits.

Best practices

  • Classify every cookie by purpose, necessary, preferences, statistics, or marketing, before writing the cookie policy, not after the fact.
  • Set SameSite=Lax as the default and reserve None only for cookies that genuinely need to work across domains.
  • Add Secure and HttpOnly to every session cookie to cut the risk of theft through a malicious script.
  • Block third-party scripts from loading until the user gives explicit consent; delaying only the cookie itself isn't enough.
  • Give persistent cookies a realistic expiration: a preference cookie doesn't need to live for two years if the user might change their mind sooner.
  • Document the real name of each cookie, its provider, and its lifespan in the cookie policy, not a generic category description.

Common mistakes

  • Loading the analytics or tracking pixel script before the user has consented, even while the cookie banner is already visible on screen.
  • Confusing "first-party cookie" with "privacy-friendly": a first-party cookie can still collect sensitive data if it isn't designed carefully.
  • Setting session cookies without Secure on sites that still serve part of their content over plain HTTP, exposing the session on unencrypted networks.
  • Assuming Chrome already killed third-party cookies, a belief that's circulated since 2020 and one Google itself corrected in April 2025.
  • Setting SameSite=None on every cookie just in case, which widens the CSRF attack surface for no real reason.
Manuel Riveiro Rodriguez CEO & Digital Strategist

A technical audit covers this and everything else in one pass.

Request an audit

Frequently asked

Can a cookie identify me personally?

On its own, a cookie only stores an identifier or a technical value, not your name. But if that identifier gets linked to your account, email address, or IP address, it can identify you, and the cookie then falls under GDPR as personal data, with the consent and deletion obligations that come with it.

Is Chrome removing third-party cookies in 2026?

No. Google confirmed in April 2025 that it would keep third-party cookies in Chrome without the extra consent prompt it had planned, and in October 2025 it retired most of the Privacy Sandbox APIs built as a replacement, after the ad industry barely adopted them.

What's the difference between clearing cookies and using incognito mode?

Clearing cookies removes ones already stored in the browser. Incognito mode simply doesn't save new cookies once you close the window. During the session itself, third-party cookies mostly behave as they would in a normal window, though Chrome does apply extra restrictions to them in incognito.

Do I need consent for technical or session cookies?

No. The ePrivacy Directive exempts cookies that are strictly necessary to deliver the service the user actually requested, such as a shopping cart or an active login. Consent is only mandatory for analytics, personalization, or advertising cookies, even when they store very little data.

What happens if my site ignores Safari's third-party blocking?

Nothing dramatic on the technical side: the browser simply won't send or accept that third-party cookie, so whatever depended on it, like retargeting, stops working for that user. Apple doesn't issue any penalty, but you do lose data that's best replaced with your own first-party analytics.

Sources

  1. RFC 6265 – HTTP State Management Mechanism (IETF): the original technical specification defining cookies and the Set-Cookie/Cookie headers. Published April 2011, still the governing reference.
  2. Using HTTP cookies (MDN Web Docs): current technical reference for the Secure, HttpOnly, and SameSite attributes and the session-versus-persistent distinction. Updated October 8, 2025.
  3. Next steps for Privacy Sandbox and tracking protections in Chrome (Google): Google's official announcement confirming Chrome will keep third-party cookies. Published April 22, 2025.