What are tracking cookies?
A tracking cookie is a cookie that holds an identifier: a random string that is unique to one browser. Each time that browser loads something from the domain that set the cookie, it sends the identifier along. The receiving server can then link all those visits together, see which pages were viewed, what was clicked and, if the cookie belongs to an ad network, which other websites the same browser visits.
The cookie itself is just a small text file, as we explain in What are cookies?. What makes it a tracking cookie is how it is used: to recognize a visitor over time and to build a profile, for statistics, advertising or both. The same technique that keeps a shopping cart can follow someone across the web. That is why the law looks at the purpose, not the technology.
How cross-site tracking works
Cross-site tracking relies on the fact that many websites load content from the same third party:
- A website embeds a script or a pixel from an ad network, for example to measure conversions or show retargeting ads.
- When a visitor opens the page, the browser fetches that script or pixel from the ad network's domain. The ad network sets a cookie with a unique ID under its own domain.
- The visitor goes to another website that embeds the same ad network. The browser sends the same cookie again, together with information about the page.
- The ad network now sees the same ID on both sites and adds the visits to one profile, which it uses to target and measure ads.
The EDPB describes the same mechanism for tracking pixels: an image or link with no purpose for the content itself, whose only job is to make the device contact the pixel's host, which may collect many such requests and so track a user's behavior. Ad networks also exchange IDs with each other ("cookie syncing"), so a profile can follow a visitor through many companies.
First-party vs third-party tracking cookies
- Third-party cookies are set under a domain other than the website you visit. They are the classic cross-site trackers, because the same cookie comes back on every site that loads that domain. Browsers increasingly restrict them; for what Chrome does, see Third-party cookies in Chrome.
- First-party cookies are set under the domain of the website itself. They are not automatically harmless. Google Analytics stores its visitor ID in the first-party cookie _ga, which lasts two years by default, and the Meta Pixel stores its browser ID in the first-party cookie _fbp on the website's domain.
So "it's a first-party cookie" does not settle whether you need consent. The Article 29 Working Party already noted that first-party cookies are far more likely to be exempt than third-party ones, but that this is only an indicator: what counts is the purpose.
Session vs persistent cookies
A session cookie has no expiry date; the browser deletes it when the browsing session ends. A persistent cookie has an expiry date or maximum age and stays until then, from minutes to years.
Duration matters in two ways. First, the longer a cookie lives, the longer it can recognize someone, which is why tracking cookies are usually persistent. Second, the EU Court of Justice ruled in Planet49 that the information you give visitors must include how long cookies stay active and whether third parties can access them.
A session cookie is not exempt just because it is short-lived. According to the Article 29 Working Party, a login cookie for one session is exempt, but a persistent "remember me" login cookie is not, and a session cookie used for advertising needs consent like any other.
The four purpose categories
Most cookie banners use four categories. They decide what needs consent:
| Category | Typical examples | Consent needed in the EU? |
|---|---|---|
| Strictly necessary | Login session, shopping cart, load balancing, security, storing the cookie choice | No |
| Preferences / functional | Language or currency the visitor chose, video player settings | Not if they only remember a choice the visitor made; otherwise usually yes |
| Statistics / analytics | Google Analytics, heatmaps, A/B tests | Yes, unless a national exemption for strictly limited audience measurement applies |
| Marketing | Meta Pixel, Google Ads, LinkedIn Insight Tag, retargeting, embedded social media that tracks | Yes |
Functional cookies are the tricky category: a cookie that remembers a language the visitor picked is exempt, a "functional" cookie that also profiles is not. If one cookie serves several purposes and one of them needs consent, the whole cookie needs consent. More on analytics in Google Analytics and the GDPR.
When do tracking cookies need consent?
The rule is article 5(3) of the ePrivacy Directive, implemented in each EU country's own law. Storing information on a visitor's device, or reading information already there, is only allowed with consent, after clear and comprehensive information. There are two exemptions: storage only used to transmit a communication over a network, and storage strictly necessary for a service the visitor explicitly asked for.
Tracking for analytics or advertising is not something the visitor asked for, so it needs consent. And that consent has to meet the GDPR standard:
- No pre-ticked boxes. The Court of Justice ruled in Planet49 that a pre-ticked checkbox is not valid consent, whether or not the cookie contains personal data.
- No consent by scrolling. The EDPB says in its Guidelines 05/2020 that scrolling or swiping through a page never counts as a clear affirmative action.
- No take-it-or-leave-it. According to the same guidelines, consent is not freely given if access to the site depends on accepting cookies (a cookie wall). More in Cookie walls.
In the UK, regulation 6 of PECR sets the same basic rule. Since February 2026 it has an exception for some analytics cookies, but not for advertising or tracking across sites.
Tracking without cookies: pixels, fingerprinting and local storage
Replacing cookies with another technique does not get you out of the rules. In its Guidelines 2/2023 on the technical scope of article 5(3), the EDPB makes clear that the rule covers any storage of or access to information on the device, regardless of whether it is personal data, and names among others:
- Tracking pixels and tracking links, including in emails, where a pixel shows that a message was opened;
- Local storage, session storage and similar browser storage;
- Scripts that make the browser collect and send information;
- Fingerprinting, which recognizes a device by its characteristics. The Article 29 Working Party already concluded in Opinion 9/2014 that this falls under the same rule.
A pixel that fires on page load, or a script that reads screen size, fonts and other properties to build a fingerprint, therefore needs consent just like a marketing cookie.
How to see which tracking cookies a site sets
- Open a private window so you start without old cookies, and do not click the banner yet.
- Open the developer tools (in Chrome: right-click, Inspect) and go to Application > Storage > Cookies. You see each cookie with its name, domain and expiry; session cookies show "Session". Check Local storage there too.
- Look at the Network tab for requests to ad and analytics domains. A request that leaves before you consent is a problem, even if it sets no cookie.
- Repeat after rejecting and after accepting. After a reject, nothing that needs consent should load.
- Use a cookie scanner for the whole site. Manual checks cover one page; a scanner also finds cookies from plugins, embeds and pages you would not think to check.
How to handle tracking cookies on your site
- Make an inventory of every cookie, pixel and script, with its purpose, provider and duration.
- Sort them into categories and ask consent per category, with rejecting as easy as accepting.
- Block tags until consent. Scripts that track may only load after the visitor agrees, and must stop when consent is withdrawn.
- Explain them in your cookie policy: each cookie, its purpose, who sets it and how long it lasts. See our cookie policy template.
- Check again regularly. New plugins and marketing tags add trackers without anyone noticing.
Cookie Confirm scans your website every month, sorts the cookies it finds into categories and blocks scripts until the visitor consents.
Sources
- ePrivacy Directive 2002/58/EC (consolidated), article 5(3)
- CJEU: Case C-673/17, Planet49
- EDPB: Guidelines 2/2023 on the technical scope of Art. 5(3) ePrivacy Directive, version 2.0
- EDPB: Guidelines 05/2020 on consent under Regulation 2016/679
- Article 29 Working Party: Opinion 04/2012 on cookie consent exemption
- Article 29 Working Party: Opinion 9/2014 on device fingerprinting
- ICO: What are the exceptions?
- Chrome for Developers: View, add, edit and delete cookies
- Google Analytics Help: Cookie usage on websites
- Meta for Developers: fbp and fbc parameters