Sub topic 8
Keeping evidence of consent
This chapter assumes you know how the GDPR and UK GDPR define valid consent, and that you can tell a consent-requiring marketing cookie from an exempt one. Earlier chapters covered both. Here the question is what you must be able to prove afterwards, and how to build records that prove it.
Why you need records at all
Consent under the GDPR and UK GDPR is a burden you carry, not a box you tick. Article 7(1) of both says that where processing relies on consent, the controller must be able to demonstrate that the data subject consented. The Article 5(2) accountability principle points the same way.
PECR and the ePrivacy Directive do not add their own record-keeping rule for cookies. They borrow the GDPR standard of consent, so the GDPR proof obligation applies to cookie consent too.
In practice, a regulator, a complainant, or a court can ask you three things:
- Did this person consent to this purpose?
- What did they see when they did?
- Is the consent still valid, or was it withdrawn or has it expired?
A banner that works but leaves no trace cannot answer any of them. If the only evidence is "our banner was configured correctly," you cannot show what happened for a specific visitor.
What a useful consent record contains
The record should reconstruct the event. The following fields cover what regulators and the EDPB guidance on consent (Guidelines 05/2020) treat as the substance of demonstrating consent.
| Field | Why it matters |
|---|---|
| Consent ID | Links the record to the browser or visitor without using their identity |
| Timestamp (UTC) | Shows when the choice was made, and lets you check it against banner and policy versions |
| Banner version | Shows which interface the visitor saw, including button labels and layout |
| Policy version | Shows which cookie policy wording was the basis of the information given |
| Choices per purpose | Shows exactly what was accepted or refused, one value per category |
| Method | Shows how the choice was made, such as "accept all", "reject all" or "accept selected" |
| Source details | Shows the page and region where the banner ran, if you need them |
The record in the topic's example captures these core fields:
{
"consentId": "c1f4e0a2-3b7d-4c55-9a10-6d2e8b9f7a11",
"timestamp": "2026-11-26T13:31:57Z",
"bannerVersion": "2026-11-01",
"policyVersion": "cookie-policy-v7",
"choices": {
"necessary": true,
"analytics": false,
"marketing": true
},
"method": "banner_accept_selected"
}The version fields do most of the work. A timestamp and a "marketing: true" flag show that someone clicked. The banner and policy versions let you retrieve the exact wording, which is what proves the consent was informed and specific. Keep an archive of every banner and policy version you have published, with screenshots or rendered text, and the version identifiers are then enough to recover what the visitor saw.
Record refusals too
Store refusals and "no choice made" outcomes as well as acceptances. A refusal record lets you show that you respected the choice, and it lets you stop re-prompting too often. It also protects you when a visitor says marketing tags fired after they declined.
Collecting only what you need
A consent record is itself personal data if it can be linked to a person. The data minimisation principle (Article 5(1)(c)) applies to it. Some fields tempt teams to over-collect:
- IP address. It is personal data, and you rarely need the full address to demonstrate consent. If you want a coarse location signal, store a truncated or hashed value, or store only the region the banner ran in.
- Full user agent string. It is useful for debugging a banner defect, but it is not needed to prove consent. Store it only if you have a reason.
- Email address or account ID. Avoid these for anonymous visitors. A random consent ID is enough. For logged-in users you may link the record to an account, but then the account's data subject rights (access, erasure) apply to that record.
A random identifier, usually a UUID, keeps the record pseudonymous. The visitor's browser holds the ID, and your server holds the record. Regulators generally accept that a first-party cookie or local storage entry that remembers the visitor's consent choice is exempt from consent, because it exists to honour their choice. Keep it limited to the choice and the ID, and put nothing else in it.
Building the record in the browser and storing it on the server
Browser-only storage is weak evidence. A visitor can clear it, and you cannot show it to a regulator for a visitor who has left. Send the record to a server you control and store it there.
const BANNER_VERSION = '2026-11-01';
const POLICY_VERSION = 'cookie-policy-v7';
function buildConsentRecord(choices, method) {
return {
consentId: crypto.randomUUID(),
timestamp: new Date().toISOString(),
bannerVersion: BANNER_VERSION,
policyVersion: POLICY_VERSION,
choices: {
necessary: true,
analytics: choices.analytics === true,
marketing: choices.marketing === true,
},
method,
};
}
async function saveConsent(choices, method) {
const record = buildConsentRecord(choices, method);
const response = await fetch('/api/consent', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(record),
});
if (!response.ok) {
throw new Error('Consent record was not stored: ' + response.status);
}
localStorage.setItem('consentId', record.consentId);
return record;
}
// Example: the visitor saves a selection in the preference centre.
saveConsent({ analytics: false, marketing: true }, 'banner_accept_selected');Two details in this code matter in production:
- Store first, then act. The marketing tag should load only after the server confirms the record. If storage fails, treat the choice as not made and keep marketing tags blocked.
- Do not trust the client for the timestamp. The browser clock can be wrong. In your API, add a server-side receipt time and keep both.
The crypto.randomUUID() method needs a secure context (HTTPS) in current browsers.
Storing records so they stay trustworthy
An editable "current consent" row is not good evidence, because it overwrites history. Use an append-only event log. Each choice, change, or withdrawal is a new row, and the current state is the latest row per consent ID.
CREATE TABLE consent_events (
event_id BIGSERIAL PRIMARY KEY,
consent_id UUID NOT NULL,
client_time TIMESTAMPTZ NOT NULL,
received_at TIMESTAMPTZ NOT NULL DEFAULT now(),
banner_version TEXT NOT NULL,
policy_version TEXT NOT NULL,
necessary BOOLEAN NOT NULL DEFAULT TRUE,
analytics BOOLEAN NOT NULL,
marketing BOOLEAN NOT NULL,
method TEXT NOT NULL
);
CREATE INDEX consent_events_by_id
ON consent_events (consent_id, received_at DESC);
-- Current state for one visitor:
SELECT *
FROM consent_events
WHERE consent_id = 'c1f4e0a2-3b7d-4c55-9a10-6d2e8b9f7a11'
ORDER BY received_at DESC
LIMIT 1;Restrict write access to the consent API, and avoid granting UPDATE and DELETE on this table to application roles. Deletions should come only from a retention job, described below.
Retention: how long to keep records
No statute sets a fixed period for consent records. The storage limitation principle (Article 5(1)(e)) means you must pick a period you can justify, and then enforce it.
A defensible approach is to keep a record for as long as the consent it describes is in force, plus a period that covers the time in which a complaint or claim could realistically arise. Write the period down, apply it with a scheduled deletion job, and check that backups follow it too. If you also re-prompt visitors after a set interval, the older records only need to stay for that complaint window.
Records of withdrawal and change
Evidence has to cover the whole life of a consent, not only its start. When a visitor changes their mind, append a new event with the new choices and the method, for example preference_centre_update or withdraw_all. Article 7(3) requires that withdrawal be as easy as giving consent, and your log should show that a withdrawal took effect. The next chapter covers the withdrawal flow itself. For this chapter, remember that each state change is its own timestamped event, and that the event time should be compared with the time marketing tags last fired for that visitor.
Records are not a substitute for working enforcement
A perfect log does not make a non-compliant site compliant. If tags fire before the visitor chooses, the log shows consent that arrived after the cookies were set. Auditors often compare the log with what the site actually does: they load a page with a clean browser profile, decline, and check whether marketing cookies appear. Any gap between the record and the behaviour is evidence against you.
Common errors
- Storing only the latest state. Overwriting loses history, so you cannot show what the visitor chose on a past date.
- No version tracking. Without banner and policy versions, you cannot prove what information the visitor had.
- Logging only "accepted." Missing refusals make it hard to show that refusals were honoured.
- Collecting too much. Full IP addresses and device fingerprints in the consent log add risk without adding proof.
- No retention rule. Keeping records forever breaches storage limitation just as deleting them too early weakens your defence.
- Records written before the choice is confirmed. Logging on page load, with consent set to true, creates false evidence.
Exercise
A visitor says your site set marketing cookies after they clicked "Reject all" on 20 November. Your consent database has one row for their consent ID, showing marketing: false, but it was last updated on 25 November when they returned and changed their settings. What is wrong with this design, and what would you change?
Show answer
The design overwrites the earlier state, so the row for 20 November is gone and you cannot show what the visitor chose or when. Change to an append-only event log with one row per choice or change, including the banner and policy versions and a server receipt time. Then you can show that the 20 November event recorded a refusal and compare its time with when marketing cookies were set.
Exercise
Your banner posts the consent record to /api/consent, and the request fails with a 500 error. Should the marketing pixel load? Explain.
Show answer
No. The choice has not been stored, so you cannot demonstrate consent as Article 7(1) requires. Keep marketing tags blocked, tell the visitor or retry, and load the pixel only after the server confirms the record and the record says marketing is true.