Analytics and Tracking

Session Cookie

Also called Non-persistent cookie, temporary cookie

One stored without an expiry date, so the browser discards it as soon as it closes.

Quick facts: Session Cookie

Category
Analytics and Tracking
Also called
Non-persistent cookie, temporary cookie
Level
Beginner
Affects
Logged-in state, baskets and checkouts, form and booking flows
Where to see it
Browser developer tools storage panel, your platform's session settings
In this article4
  1. How a session cookie works
  2. Why session cookies matter
  3. Where session cookies go wrong
  4. What to do about it

When a site sets a cookie it can include an expiry date. If it does not, the browser stores the value only for the current browsing session and throws it away when the browser is closed. That is the entire difference between a session cookie and a persistent cookie: one has a date on it and one does not.

The name is slightly misleading, because a browser session is not the same as an analytics session. Analytics tools define a session by inactivity or by a change of campaign, and they usually end one long before the browser is closed. A session cookie survives for as long as the window stays open, which on a phone can be days, and on a laptop that never fully shuts down can be longer still.

Why session cookies matter

They hold the state that makes a website usable within a single visit. A logged-in session, a shopping basket, a multi-step form or booking flow, a security token that proves a form submission came from your own page — all of these are typically session cookies, and all of them are things the visitor asked for by using the site.

That gives them a useful property: because they are necessary for the service the visitor requested, they generally do not require consent. It is one of the reasons a well-built site can still work properly for someone who refuses every optional cookie, and why refusing a banner should never leave a customer unable to check out.

Where session cookies go wrong

The first problem is treating one as a memory. A visitor who reads about you on a phone in the morning and returns in the evening arrives with an empty session, so nothing carries over: not the basket, not the login, not the answer they typed into your form. If a session cookie is holding something the customer would be annoyed to lose, it is the wrong tool.

The second is misclassifying them in a cookie policy. Some session cookies really are necessary and some are not, and a marketing script can set one just as easily as a checkout can. Judge each by purpose rather than by lifetime.

The third is a session that quietly outlives its usefulness on a shared device — an internet cafe, a hotel desk, a family tablet — where the next person inherits an open window and whatever it remembers.

What to do about it

List the cookies your site sets and note which have no expiry date. For each one, ask what would break if it disappeared mid-visit and what would leak if it did not. Anything holding sensitive state should also have a server-side timeout, so an abandoned window stops being a valid session even if the browser stays open.

Where a session cookie is doing necessary work, say so plainly in the cookie table of your privacy policy rather than lumping everything together as “tracking”. And if a customer’s progress through a long form or a booking is being lost between visits, that is a design decision to revisit — conversion rate work often starts with something as small as remembering what someone already typed.

Do and do not

Do

  • Use them for state that only matters within one visit
  • Add a server-side timeout for anything sensitive
  • Classify each one by purpose in your cookie table

Do not

  • Rely on one to remember a returning customer
  • Assume the window will close any time soon
  • Label every session cookie as strictly necessary

Questions people ask about this

Does a session cookie need consent?

Usually not, if it is doing work the visitor asked for: keeping them logged in, holding a basket, carrying a security token through a form. The exemption comes from the purpose, not the short life. A session cookie set by an advertising script is still an advertising cookie and belongs behind the consent banner.

How long does a session cookie actually last?

Until the browser closes, which is far less predictable than it sounds. Phones keep tabs alive in the background for long stretches, and many people never quit their desktop browser at all. Some browsers even restore session cookies when they reopen previous tabs, so treat the lifetime as unknown rather than short.

Is a session cookie the same as an analytics session?

No, and confusing the two leads to misread reports. An analytics session is defined by the measurement tool, typically ending after a period of inactivity or when a new campaign brings the visitor back. A session cookie is defined by the browser window. One visit in analytics can span several, or sit inside one long browser session.

Related terms

Found this useful?

Share it, or ask an AI to summarise it

Back to the glossary

Knowing the term is the easy part

Applying it to your own site and budget is the work. Book a call and I will tell you what actually applies to you.