
This post talks about: Compliance updates, Getting started guides
In short
A session cookie only lives as long as the browser stays open: when you close it, the cookie is deleted. Session cookies that keep the login or the cart active are technical cookies and don’t require consent, but they must be listed in the notice. Be careful, though: lifetime alone decides nothing. A session cookie used for tracking or profiling requires consent like any other.
You add a pair of shoes to the cart, open the size guide, go back to the catalog and head to checkout. The cart is still there, with the shoes in it.
It seems obvious, but it isn’t. The web, as it was born, has no memory: every page you open is a new request, unconnected to the previous one. If the website remembers you from one page to the next, it’s almost always thanks to a session cookie.
In this guide we look at what they are, how they work, how they differ from persistent cookies and when you can use them without asking for consent.
What are session cookies?
A session cookie is a small text file that the website stores in the visitor’s browser only for the duration of the visit. It has no expiry date: when the visitor closes the browser, the cookie is deleted.
Its job is to give continuity to browsing. The European authorities’ Opinion 04/2012 on cookie consent exemption lists many session cookies among those that can be exempt: those that remember what the visitor has entered in a form or in the cart, and those that keep them authenticated after login, with the example of online banking: without them, the visitor couldn’t see their balance or account transactions.
The most common examples are these:
- e-commerce: the cart that follows you from page to page until payment;
- members’ area: the login that stays active while you browse, without having to re-enter your password at every click;
- online banking: the session that expires after a period of inactivity, for security;
- multi-step forms: the data from the first step that remains available in the second;
- WordPress: the session of whoever manages the website.
How does a session cookie work?
The mechanism follows four steps.
- Opening. When the visitor arrives on the website, the server creates a unique identification code, the session ID, and sends it to the browser inside a cookie.
- Storage. The browser keeps the cookie and sends it back to the server with every new request, that is, with every page opened.
- Recognition. The server reads the code and links the request to the same session: it knows that whoever is requesting the checkout page is the person who filled the cart. Usually the actual data (the contents of the cart, the login status) stays on the server, while the cookie contains only the code.
- Closing. When the visitor closes the browser, the cookie is deleted. On the next visit, a new session starts, with a new code.
What is the difference between session cookies and persistent cookies?
While a session cookie disappears when the browser is closed, persistent cookies (or permanent cookies) have an expiry date and remain in the browser: for hours, months or years, until they expire or until the visitor deletes them. They are used to remember something from one visit to the next.
| Session cookies | Persistent cookies | |
|---|---|---|
| Lifetime | Until the browser is closed | Until the set expiry date, or until deleted |
| What they remember | Information about the current visit | Information between one visit and the next |
| Technical examples | Cart, login, multi-step form | Choice made on the cookie banner, chosen language (with a caveat: see below) |
| Non-technical examples | Identifiers of tracking tools tied to the single visit | Analytics identifiers and advertising pixels, which last months or years |
As you can see, the same column contains technical and non-technical examples. That’s no accident: it’s the most important point of this guide.
Lifetime and purpose: why they are two different things
Session versus persistent is a distinction based on lifetime. Technical versus profiling is a distinction based on purpose. They are two different axes, and only the second decides whether you need consent. Lifetime only matters as a check: a technical cookie must last as long as its purpose requires, and no longer. According to Opinion 04/2012, for example, the cookie that keeps the login active even after the browser is closed is not exempt.
Opinion 04/2012 itself says so. Cookies can be classified by lifetime, session or permanent, or by who installs them, first or third party. But to decide whether a cookie is exempt from consent, you must always look at its purpose, not at one of its technical characteristics. This gives two broad categories:
- technical cookies, which serve only to make the website work or to deliver a service requested by the visitor;
- profiling cookies and the other tools with non-technical purposes.
The rule comes from Article 5(3) of the ePrivacy Directive (2002/58/EC), transposed into the law of each Member State: in Italy by Article 122 of the Italian Privacy Code, in France by Article 82 of the loi Informatique et Libertés. Consent is required, except for what serves only to transmit the communication or is strictly necessary to provide a service the user has explicitly requested. The article says nothing about lifetime.
So, combining the two axes:
- session and technical: the cart cookie. No consent;
- persistent and technical: the cookie that remembers the choice made on the banner. No consent. On the cookie that remembers the language, authorities are not aligned: the French CNIL considers it exempt if choosing the language is an expected part of the service; Opinion 04/2012 exempts it only if it is short-lived and, for longer lifetimes, asks for a warning next to the choice (for example “uses cookies” next to the little flag);
- session and non-technical: an identifier that a tracking tool uses to follow the visitor during the visit. Consent is required, even if it lasts only a few minutes;
- persistent and non-technical: advertising pixels and analytics identifiers, which last months. Consent is required.
Learn more about the two categories in the guides Technical cookies: what they are and when you don’t need a banner and Profiling cookies: what they are, examples and when consent is required.
When do session cookies not require consent?
When they are technical, that is, strictly necessary to make the website work or a service the visitor has asked for. The examples above (cart, login, forms, online banking) fall into this group: without those cookies, the service the visitor is using wouldn’t work.
Two things, however, remain mandatory even in this case.
- The notice. Visitors must be informed about technical cookies too. If they process personal data, such as the session ID, the GDPR requires it (Articles 12-13), and several national authorities require it in any case. In the cookie policy you state which ones you use, what they are for and how long they last. For a session cookie, the lifetime is simply “session.”
- Checking the purpose. A cookie doesn’t become technical because it expires quickly. Before considering it exempt, ask yourself what it actually does.
If your website uses only technical cookies, session or persistent, there is no consent to ask for: the information can go on the home page or in the general notice, without a banner to close. We cover this in the guide on technical cookies.
When do you need consent, even for a session cookie?
Whenever the purpose is not technical. This happens mainly in three cases.
- Third-party session cookies. An embedded video, map or widget can store its provider’s session cookies as soon as the page loads. If the provider uses them for its own purposes, you need consent and preventive blocking. See Third-party cookies vs first-party cookies: what’s the difference.
- Analytics and behavior-recording tools that follow the individual visitor during the visit. For analytics, the rules are specific: you’ll find them in Analytics cookies: what they are and when you need consent.
- Session cookies used for marketing, for example to attribute the visit to a campaign and pass the data on to an advertising platform.
How can you tell if a cookie is a session cookie?
In the browser’s developer tools, the list of cookies has a column with the expiry: for session cookies, instead of a date, you’ll see the word “Session.”
This, however, tells you the lifetime, not the purpose. To understand what each cookie is for, you have to trace it back to the tool that creates it: the next guide in the series explains step by step how to take a full inventory of your website’s cookies.
What your website needs to do, in 4 steps
- List the cookies and tools present, session and persistent, first and third party.
- Classify them by purpose, not by lifetime. Technical or non-technical: it’s the only question that decides whether you need consent.
- Block the non-technical ones until the visitor accepts, even if they are session cookies.
- Describe them all in the cookie policy, stating for each one what it is for, who manages it and how long it lasts.
What My Agile Privacy® does
My Agile Privacy® is the WordPress consent management plugin designed to carry out these steps for real, not just on the surface.
- Cookie Shield detects third-party services on your website and, in Live mode, blocks them automatically until the visitor gives consent, as European rules require.
- Granular consent: the visitor chooses service by service, while technical cookies keep doing their job.
- Cookie policy and privacy policy included, prepared with the Policy Assistant and updated when the rules change.
- Support from human experts: real people, not bots.
FAQ - Frequently Asked Questions
Back to Getting started guides

