Skip to main content
Back to Articles
Compliance6 min readBy Armin Zaribaf

Cookie Data Retention: How Long Should You Keep the Data?

GDPR's storage limitation principle says personal data can't sit around forever. This guide covers how long cookies should live, how long the data they collect can be kept, and how to write a retention schedule that survives a regulator's question.

Storage Limitation Is a Rule, Not a Suggestion

The GDPR gives you six words that decide this whole topic: keep personal data no longer than necessary. That's the storage limitation principle in Article 5(1)(e). Cookies collect personal data, online identifiers, device details, browsing behaviour, so the data they generate falls squarely under it. If a regulator asks how long you keep it and why, "we've never deleted anything" is the wrong answer.

Most teams set up a consent banner, categorise their cookies, and stop there. Retention is the part that gets skipped, partly because it involves two separate clocks that are easy to confuse. Get them straight and the rest is bookkeeping.

The first clock is the cookie's own lifespan, the expiry you set with the cookie's max-age or expires attribute. A session cookie dies when the browser closes. A persistent analytics cookie might be set to live for months. This clock controls how long the identifier sits on the visitor's device.

The second clock is how long you retain the data the cookie feeds. An analytics cookie identifies a returning visitor, but the events it generates land in your analytics backend and your server logs, and those can be kept on a completely different schedule. You could delete the cookie tomorrow and still be holding two years of behavioural records tied to it.

A retention policy has to name both. It's common to see a site advertise a tidy 13-month cookie lifespan in its cookie policy while quietly retaining the underlying analytics data for years. That gap is exactly what an auditor picks up on.

What the Numbers Look Like in Practice

Default cookie lifespans and what regulators expect don't always line up. Google's _ga cookie is set to last two years out of the box, while the CNIL would prefer you cap analytics trackers at 13 months. When defaults and guidance disagree, the safer move is to shorten, then document why.

Common trackers, typical lifespans, and the data behind them
Cookie / toolDefault cookie lifespanUnderlying data retentionNotes
Google Analytics (_ga)2 years by defaultGA4 event/user data: 2 or 14 months (up to 50 on 360)CNIL suggests capping the cookie at 13 months
Meta Pixel (_fbp)~90 daysHeld by Meta per its termsYou are a controller for the ad targeting you enable
Session / cart cookieSession or shortOrder data kept per your commerce and tax rulesNecessary function, but scope the retention
Consent recordStored client-side plus server logAs long as you rely on the consent, plus a limitation periodA different clock again, see below

Setting GA4 Data Retention (the setting most people miss)

Google Analytics 4 ships with data retention set to two months. Under Admin > Data settings > Data retention you can raise event and user data to 14 months on a standard property, or up to 50 months on Analytics 360. Two things bite people here. The change isn't retroactive, so if you leave the default and later switch to 14 months, you don't get the missing history back. And the setting only governs the granular, explorable data; aggregated standard reports persist longer. Pick your retention deliberately when you create the property. Google documents the behaviour in the GA4 data retention help page.

Here's a trap: teams apply the same short retention to their proof-of-consent logs that they apply to marketing data, then can't prove consent when challenged. Consent records aren't the data you minimise aggressively. You keep them for as long as you're relying on that consent, plus a reasonable window to defend a legal claim after the relationship ends. "Forever" is wrong, but so is deleting the receipt the day the cookie expires. We cover the record itself in proof of consent under GDPR and consent logging and audit requirements.

Writing a Retention Schedule

A retention schedule is a table your future self and a regulator can both read. One row per data category, each answering the same questions. It doesn't need a lawyer to draft, it needs someone who knows what data you actually collect, which is why it starts from a real cookie inventory rather than a template.

Each retention-schedule row should name

  • The data category and its purpose

    For example: analytics events for traffic measurement, or ad-click data for campaign attribution.

  • The legal basis

    Consent for non-essential trackers; legitimate interests or contract only where genuinely applicable.

  • The cookie lifespan

    The max-age you set on the client-side cookie itself.

  • The backend retention period

    How long the collected data lives in analytics, your warehouse, and logs.

  • The deletion method and trigger

    Automated expiry, a scheduled purge job, or a manual review date.

  • The owner

    The person or team accountable for enforcing that row.

5 min read

TCF and Google Additional Consent Explained

Google runs ad tech partners that aren't on the IAB Global Vendor List, so TCF alone can't signal consent for them. The Additional Consent (AC) string fills the gap. Here's the format and how a CMP produces it.

5 min read

Google's Certified CMP Requirement for AdSense, Ad Manager and AdMob

If you serve personalised ads on your site or app in the EEA, UK or Switzerland through Google AdSense, Ad Manager or AdMob, Google requires a certified CMP integrated with the IAB TCF. Here's what that means, the enforcement dates, and the revenue cost of ignoring it.

9 min read

TCF v2.4: What Changed for Publishers and CMPs

TCF v2.4 adds standard explanation texts and illustrations to the Global Vendor List, renames Special Feature 2, updates TCF Policies to v5.0.b, and introduces multi-device consent provisions. Required on web since 23 October 2026; apps and CTV by 23 February 2027.

6 min read

Is Your Analytics Vendor a Controller or Processor?

When you run Google Analytics, is Google acting on your instructions or its own? The answer decides who's liable, what contract you need, and whether the setup is even lawful. It varies by vendor, and sometimes by a single checkbox.