Code BLACKGO: cookie banner free for a year. Create an account →

Publications / Law and cookies

Types of cookies – first-party and third-party, session and persistent, necessary and marketing

Cookies are classified by origin, lifetime and purpose. Only the classification by purpose decides whether consent is needed. Examples of real cookies, similar technologies (localStorage, pixels) and common misconceptions.

Author: Anna.K Published: 4 min read

Types of cookies – first-party and third-party, session and persistent, necessary and marketing

Cookies are classified in three ways: by who stores them, how long they live and what they are used for. For the banner and consent, only the third classification counts – the purpose. A cookie can be first-party and session-only and still require consent, because it is used for statistics.

By origin: first-party and third-party

  • First-party – stored in the domain of the site you are visiting. Example: a cart session cookie, but also the Google Analytics _ga cookie, which the Google script stores in your site's domain.
  • Third-party – stored in the domain of another service, e.g. IDE in the doubleclick.net domain (Google ads). Browsers increasingly restrict them, but that does not change the consent requirement.

By lifetime: session and persistent

  • Session – deleted when the browser is closed.
  • Persistent – have an expiry date, from minutes to years. Examples: _gid (24 hours), _fbp (90 days), _ga (2 years), IDE (13 months).

The lifetime must be stated in the cookie policy, but on its own it does not decide whether consent is needed.

By purpose: four categories

CategoryWhat it is forExamplesConsent
Necessaryfor the site to work and for the service the visitor requestssession, cart, login, security, remembering the choice in the bannerno
Functionalextras and conveniencechat, maps, embedded videos, remembered languageyes
Analyticstraffic and behaviour statisticsGoogle Analytics 4 (_ga, _gid), Hotjaryes
Marketingad measurement, remarketing, profilingGoogle Ads (_gcl_*), Meta Pixel (_fbp), TikTok, IDEyes

The basis: Article 5(3) of the ePrivacy Directive (implemented in national laws) exempts from consent only what is strictly necessary. Everything else – including “functional” cookies – requires consent.

Not only cookies: similar technologies

The consent rule covers any storing and reading of information on the device, not only cookies. The European Data Protection Board described this in Guidelines 2/2023 on the technical scope of Article 5(3) of the ePrivacy Directive. The same rules cover, among others:

  • localStorage and sessionStorage in the browser,
  • tracking pixels (e.g. a 1×1 image on a page or in an email),
  • identifiers in link URLs,
  • browser fingerprinting.

Common misconceptions

  • “The cookie is first-party, so no consent is needed” – _ga is a first-party cookie, yet it is used for statistics.
  • “The cookie is a session cookie, so no consent is needed” – the purpose decides about consent.
  • “Analytics is necessary for the business” – necessary for the business is not the same as necessary for the site to work.
  • “We don't use cookies, only localStorage” – the rule also covers other storage technologies.

How it looks in consetgo

The module has four categories: necessary, functional, analytics and marketing. For known services it has a list of cookies with their retention period and purpose – it shows this list to visitors in the banner settings and in the table for the cookie policy. How to assign services to categories: cookie categories for services. The law: ePrivacy Directive, EDPB guidelines.

Questions and answers

Do session cookies not require consent?

It is not the lifetime that decides, but the purpose. A session cookie for the cart is necessary, but a session cookie of an analytics tool requires consent, even though it disappears when the browser is closed.

Is localStorage also “cookies”?

The consent rule (Article 5(3) of the ePrivacy Directive) covers any storing and reading of information on the device – including localStorage, tracking pixels and browser fingerprinting. Website policies usually call all of them cookies.

Are first-party cookies safer?

The origin of a cookie does not exempt it from consent. The Google Analytics _ga cookie is stored in your site's domain, yet it is used for statistics and requires consent.

This is general information, not legal advice.

Read also

How to write clear cookie banner texts – rules and examples

How to write clear cookie banner texts – rules and examples

Law and cookies

Consent is valid only if the visitor understands what they are agreeing to. What the banner texts must make clear, how to name buttons and categories, examples of neutral texts and what happens after you change them.

· 6 min read

Dark patterns in cookie banners – what to avoid

Dark patterns in cookie banners – what to avoid

Law and cookies

Deceptive design patterns in cookie banners according to EDPB Guidelines 03/2022 and the report of the EDPB Cookie Banner Taskforce. What follows from the law, what is the authorities' position and how to check your own banner.

· 6 min read