Tracking cookies: what they are and when you need consent

How tracking cookies follow visitors across websites, the difference between first-party and third-party and between session and persistent cookies, and which purposes need consent. Plus pixels, fingerprinting and local storage, and how to find out what a site really sets.

Last checked on 24 November 2026

In short

  • A tracking cookie holds an identifier that lets a website or an ad network recognize a browser and build a picture of its behavior, often across many sites.
  • Not the technique but the purpose decides whether you need consent: only what is strictly necessary for a service the visitor asked for is exempt.
  • Tracking pixels, fingerprinting and local storage fall under the same rule as cookies (EDPB Guidelines 2/2023).
  • Tracking has to wait until the visitor consents; a banner that only informs while the tags already fire does not meet the rules.

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:

  1. A website embeds a script or a pixel from an ad network, for example to measure conversions or show retargeting ads.
  2. 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.
  3. 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.
  4. 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

  1. Open a private window so you start without old cookies, and do not click the banner yet.
  2. 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.
  3. 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.
  4. Repeat after rejecting and after accepting. After a reject, nothing that needs consent should load.
  5. 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

Frequently asked questions

What is a session cookie?

A session cookie is a cookie without an expiry date. The browser deletes it when the browsing session ends, usually when you close the browser. Websites use it for things like keeping you logged in or remembering your shopping cart while you browse. In Chrome DevTools its expiry column simply says "Session".

What is the difference between first-party and third-party cookies?

A first-party cookie is set under the domain of the website you visit; a third-party cookie under another domain, such as an ad network whose script or pixel is on the page. Third-party cookies can recognize the same browser on every site that loads that domain. First-party cookies can track too: the Meta Pixel, for example, stores its identifier in a first-party cookie.

Are tracking cookies illegal?

No, but in the EU you may only place them after the visitor has given valid consent: freely given, specific, informed and by a clear action. A pre-ticked box, scrolling on or simply continuing to browse is not consent.

Do I need consent for a tracking pixel if it sets no cookie?

Yes, as a rule. The EDPB confirms in its Guidelines 2/2023 that article 5(3) of the ePrivacy Directive also covers tracking pixels and other techniques that make the device send information, not just cookies.

Are marketing cookies and tracking cookies the same thing?

Mostly. "Marketing cookies" is the purpose category in a cookie banner; most of the cookies in it are tracking cookies used for ads, retargeting and conversion measurement. Analytics cookies also track behavior, but usually only on your own site.

This guide is general information, not legal advice. We check it regularly, but laws and guidance change. Not sure about your situation? Ask a lawyer.

Enjoy the first 7 days completely free

Create a free account and see if Cookie Confirm is the right fit for you. Live in 5 minutes.

  • No credit card required
  • €7.95 per month after
  • Plug & play installation
Start my free trial

5.0/5 5,000+ websites

Enjoy the first 7 days completely free

No credit card required

Start free trial