TapCub is live — analytics, insights and live chat, free on one platform
Glossary

What is persistent data? Cookies local storage and server-side records

Persistent data outlives the page or session that created it. A lifetime table for cookies, web storage and the server, browser caps on script-written storage with a worked example, and what privacy rules apply.

Su He Reviewed by Ethan Brooks Also called data persistence Last updated Nov 22, 2026 Glossary

Quick answer

Persistent data is data that outlives the process, page or session that created it, kept on non-volatile storage until it is deleted or expires. In web analytics it covers identifiers stored in the browser (persistent cookies, localStorage) and records kept on the server under a retention rule.

What is persistent data?

Persistent data is data that outlives the process, page or session that created it. It sits on non-volatile storage (a disk, a database, the browser's saved storage) and stays available until something deletes it or it expires. The opposite is non-persistent (ephemeral) data, which lives in memory and disappears when the process ends.

In everyday computing, a saved document, a database row and a game save file are persistent; a variable in a running program is not. In web analytics the phrase usually means two things:

  1. Persistence in the browser: an identifier or setting the page stores on the visitor's device so it is still there on the next visit. Persistent cookies, localStorage and IndexedDB do this.
  2. Persistence on the server: events, visitor records and reports saved in a database, kept for as long as the retention rule says.

The reason analytics cares is identity. A tool can only say "this is a returning visitor" if something persists between visits, either an id stored in the browser or a rule on the server that recognises the same visitor again. Persistence is therefore both the thing that makes returning-visitor and retention reports possible and the thing that raises privacy questions.

"Persistent" does not mean "permanent". Every browser store has limits, users clear them, and servers delete data on a schedule.

Where persistent data lives: lifetimes compared

The same visitor id can be stored in several places, and each place has its own lifetime.

StorageHow long it lastsScopeNotes
Session cookieUntil the browser session ends; a browser with session restore may bring it backSent to the server with every requestA cookie with no Expires or Max-Age is a session cookie
Persistent cookieUntil the date in Expires, or for Max-Age secondsSent to the server with every requestMozilla documents that Max-Age takes precedence when both are set
sessionStorageUntil the browser tab is closedOne tab and one originNot shared between tabs
localStorageStays after the browser is closed and reopenedOne origin; all pages on it share itNo built-in expiry; the page or the user must clear it
IndexedDBPersistent until clearedOne originLarger structured storage
Server-side recordUntil deleted or the retention period endsWhole projectNot in the browser at all; the visitor cannot clear it
No storage (hash of address, browser and a salt)As long as the salt lastsServer onlyNothing is written to the device

The difference between a cookie and web storage that matters most for analytics: a cookie travels to the server automatically, while localStorage stays on the device until the page's own script reads it and sends it.

Browsers cap how long script-written data survives

A page can ask for a cookie to last a year, but the browser decides. WebKit's tracking prevention documentation (used by Safari) says its Intelligent Tracking Prevention deletes all cookies created in JavaScript and all other script-writeable storage after 7 days without user interaction with the website. The affected storage includes IndexedDB, localStorage, sessionStorage and service-worker registrations and caches. When a landing page URL carries link decoration (extra query parameters of the kind used in tracked links), the expiry of cookies created in JavaScript on that page is capped at 24 hours.

For analytics, the practical effect is that an identifier written by a script on the page may last 7 days or less in Safari, whatever the code says. Browser rules change; check the browser vendors' current documentation, including how cookies set by a server are treated, before you rely on any lifetime.

Worked example: how much a 7-day cap loses

Sample data with stated assumptions: 10,000 visitors come back once within 30 days of their first visit, on a day uniformly spread across days 1 to 30. 25% of them (2,500) use a WebKit browser; assume the identifier is script-written and capped at 7 days. The other 7,500 keep it for the full 30 days.

GroupVisitors returningRecognised as the same visitor
Other browsers7,5007,500 (100%)
WebKit, 7-day cap2,5002,500 × 7 ÷ 30 = 583 (23.3%)
WebKit, 24-hour cap (link-decorated landing)2,5002,500 × 1 ÷ 30 = 83 (3.3%)
Total, 7-day cap10,0008,083, so 80.8% are recognised

So 1,917 returning people are counted as new visitors, and the "new visitor" count and the retention curve both mislead. The size of the error depends on your browser mix and your return pattern; replace 25% and the uniform timing with your own numbers. The point of the example is that a persistence limit shows up as a change in your metrics, not as an error message.

Persistence and privacy rules

A persistent identifier is also a legal object.

  • Storing or reading on the device. Article 5(3) of the EU's ePrivacy Directive (2002/58/EC, consolidated text) says storing information, or gaining access to information already stored, in a user's terminal equipment is only allowed on condition that the user has given consent, with an exception for what is strictly necessary to provide a service the user explicitly requested. This applies to cookies and to localStorage alike.
  • Identifiers are personal data. The GDPR's Article 4(1) defines personal data as any information relating to an identified or identifiable natural person, and lists an online identifier among the identifiers that can make someone identifiable. A random id stored for months can therefore count as personal data if it can be linked back to a person.
  • Server-side data has a clock too. Rules on storage limitation mean raw records need a retention period, after which they are deleted or reduced to aggregates.

This is a summary of the texts linked in Sources, not legal advice. For how a design without stored identifiers fits these rules, see privacy-first analytics.

What is persistent and what is not: a checklist

Use this to audit your own site:

  1. List every cookie and every localStorage or IndexedDB key your pages write (the browser's developer tools show them under Application).
  2. For each one, write who sets it (your server or a script), how long it lasts and what it holds.
  3. Mark any that holds an identifier or personal data. These need the consent logic of your region.
  4. Check that nothing sensitive (passwords, tokens that grant access) is in localStorage, which any script on the page can read.
  5. For server-side data, write down the retention period per data type: raw events, aggregates, exports, backups.

Related definitions: first-party cookie, third-party cookie and cookieless analytics.

Common mistakes

  • Equating persistent with permanent. Browsers cap and users clear; plan for loss.
  • Believing a long Max-Age is honored everywhere. A 7-day cap on script-written storage in some browsers makes your 1-year cookie a 7-day cookie.
  • Storing secrets in localStorage. It is readable by any script on the origin, so an injected script can read it.
  • Treating a random id as not personal. If it lets you recognise a person across visits, the law may treat it as an identifier.
  • Counting "new visitors" without checking persistence. A rise in new visitors can be an expired id, not growth.
  • Forgetting the server side. Deleting the cookie does not delete the data already stored under it.

Persistent data in TapCub

TapCub's default is not to store anything in the browser, which makes the checklist short.

  1. Default: nothing persisted on the device. In anonymous analytics the website script writes neither a cookie nor local storage. Visitors are separated with a hash of the address and browser data and a salt; the project is created in this mode.
  2. How long a visitor is recognised depends on the salt. The default Balanced preset keeps a site-level salt so new and returning visitors can be compared. Strict rotates the salt each day and does not report returning visitors across days. Both truncate the address before storage. The preset is in Configuration › Settings › Privacy.
  3. A device id only with consent and identification. Identified mode writes a device id once consent is granted and the collection tier is 3, then creates a person at tapcub.login. Without it, visitors who never log in stay in aggregates. The tiers and the consent rules are in Configuration › Privacy center; in the European Economic Area and the UK the default rule needs consent, and without it collection falls to the lowest tier while pageviews and custom events are still stored.
  4. Chat remembers only if asked. The chat token lives in session storage by default and dies when the tab closes. If Let visitors "remember my conversation for 30 days" is on, the visitor can choose to keep it in local storage for 30 days.
  5. Server-side persistence is governed by retention. In All-platform analytics › Data › Data export you can request an asynchronous raw export; detail beyond the retention period has been deleted, while the daily summaries contain no personal data and are not deleted by the retention period.

Sources

  • MDN Web Docs, Set-Cookie header (session vs permanent cookies; Expires; Max-Age precedence), checked 22 November 2026
  • MDN Web Docs, Web Storage API (localStorage persists after the browser is closed; sessionStorage ends with the tab), checked 22 November 2026
  • WebKit, Tracking Prevention (script-written cookies and storage deleted after 7 days without interaction; 24-hour cap with link decoration), checked 22 November 2026
  • European Union, Directive 2002/58/EC, consolidated text (Article 5(3)), and Regulation (EU) 2016/679 (Article 4(1), personal data and online identifier), checked 22 November 2026

Was this explanation clear?

We use your answers to fix and expand this page.

Su He

Data Analyst

Explores traffic sources, conversion funnels, and retention, using clear metric definitions and concrete examples to explain what the numbers mean.

FAQ

Questions people ask

Short answers to the follow-up questions that come up most.

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What is persistent data?

Persistent data is data that survives after the process, page or session that created it ends, because it is stored on non-volatile storage such as a disk, a database or the browser's saved storage. It stays until it is deleted or expires. Ephemeral data in memory is its opposite.

What is the difference between a session cookie and a persistent cookie?

A session cookie has no Expires or Max-Age and is removed when the browser session ends. A persistent cookie is removed at a set date or after a set number of seconds, not when the browser closes. If both Expires and Max-Age are set, Max-Age takes precedence.

How long does localStorage last?

localStorage data stays after the browser is closed and reopened, and has no built-in expiry; it lasts until the page or the user clears it. Safari's tracking prevention deletes script-writeable storage, including localStorage, after 7 days without user interaction with the website.

Does persistent data need consent?

In the EU, storing or accessing information on a user's device needs the user's consent unless it is strictly necessary for a service the user requested (ePrivacy Directive, Article 5(3)). An identifier that can make a person identifiable is also personal data under GDPR Article 4(1).

See this number on your own site

Add one script tag for web and apps, and the first reports fill in within minutes.

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics