This guide gives an overview; it does not replace legal advice suited to your situation.
The definition
A cookie is a small piece of data (a name and a value, for example basket=3f9a…) that a website asks the browser to store. On every new page, the browser sends it back to the site that created it. That is how a site “remembers” you, even though the web, by design, forgets everything between pages.
The idea dates from 1994: Lou Montulli, at Netscape, was looking for a reliable way to remember the contents of a shopping basket. A cookie is not a program: it does not run and does not read your files. What matters is the identifier it holds, and who can read it back.
The main kinds
Two questions are enough to sort any cookie.
- Who sets it? A first-party cookie belongs to the site you are visiting (the basket, the chosen language). A third-party cookie belongs to another domain loaded in the page: an ad network, a social network, a video player. That is what makes it possible to recognise the same person across thousands of different sites.
- How long does it live? A session cookie is deleted when the browser closes. A persistent cookie has an expiry date: a few minutes, six months, two years.
Careful: “first party” does not mean “harmless”. Google Analytics’ _ga is set on your own domain and is still used for measurement that generally needs consent. The law does not look at the domain, it looks at the purpose.
What the law says
In Europe, the rule comes from Article 5(3) of the ePrivacy Directive, written into French law as Article 82 of the French Data Protection Act: storing or reading information on a visitor’s device needs their prior consent, with two exceptions:
- what is used only to carry out a communication (load balancing, for example);
- what is strictly necessary for the service the visitor asked for: the basket, logging into their account, remembering their cookie choice.
The French regulator (CNIL) also treats audience measurement that meets strict conditions as exempt. Everything else (advertising, social networks, most analytics) waits for a clear “yes”, given through an active gesture, and rejecting must be as easy as accepting. To find out whether your site is concerned, read do I need a cookie banner.
Other trackers: the same rule applies
The law does not talk about “cookies” but about access to the device. The CNIL and the European Data Protection Board (EDPB, in its Guidelines 2/2023, final version adopted in October 2024) therefore also cover:
- browser storage:
localStorage,sessionStorage, IndexedDB; - invisible pixels, one-pixel images loaded from another service to report your visit;
- fingerprinting: recognising a device from its technical characteristics (screen, fonts, settings) without storing anything on it;
- mobile advertising identifiers.
Swapping a cookie for one of these techniques therefore does not remove the need for consent. We go into this in our guide to cookieless tracking.
With Optooki
Optooki’s scanner visits your site as a new visitor and lists every cookie with its service, category and lifetime: you finally see what your site sets. Services recognised among the 136 in the catalogue are then blocked until consent, and the cookie list in your policy keeps itself up to date.