Store and Honor Consent Records
Record what each user consented to, when, and under which policy version, then gate optional processing on the current consent so you can prove and honor it.
Task
Add a consent store that records policy version and purpose so optional data use can be enabled, disabled, and audited.
When to use this
The app collects consent in a banner but never stores which policy version or purposes were accepted, so it cannot prove or withdraw consent.
Prerequisites
- A store for consent records
- A policy version identifier
Steps
1. Record user id, purpose, policy version, decision, and timestamp for each consent.
Expected output: Every decision is attributable and dated.
2. Gate optional processing on the presence of an active consent for that purpose.
Expected output: Processing only occurs when permitted.
3. Let users withdraw consent and propagate the change to downstream systems.
Expected output: Withdrawal actually stops the processing.
4. Keep an immutable history so past decisions can be audited.
curl -X POST https://api.example.com/consent -d '{"purpose":"analytics","granted":true,"policy":"2.1"}'Expected output: You can show what was consented to when.
Troubleshooting
Problem
Consent not enforced downstream
Solution
Propagate withdrawal to analytics and marketing systems, or read the consent store as their source of truth.
Problem
Policy version drift
Solution
Increment the policy version when terms change and re-prompt where required.
Limitations
- A consent record is only as good as its enforcement; storing it without gating processing gives a false sense of compliance.
- Consent does not cover all lawful bases; some processing rests on contract or legal obligation instead.
Context
Add a consent store that records policy version and purpose so optional data use can be enabled, disabled, and audited. The app collects consent in a banner but never stores which policy version or purposes were accepted, so it cannot prove or withdraw consent.
Steps
- Record user id, purpose, policy version, decision, and timestamp for each consent. Expected: Every decision is attributable and dated.
- Gate optional processing on the presence of an active consent for that purpose. Expected: Processing only occurs when permitted.
- Let users withdraw consent and propagate the change to downstream systems. Expected: Withdrawal actually stops the processing.
- Keep an immutable history so past decisions can be audited. Expected: You can show what was consented to when.
await consents.insert({
userId, purpose: 'analytics', policyVersion: '2.1',
granted: true, at: new Date(), source: 'banner',
});
const allowed = await consents.active(userId, 'analytics');
Verify
- Every decision is attributable and dated.
- Processing only occurs when permitted.
- Withdrawal actually stops the processing.
- You can show what was consented to when.
Limits
- A consent record is only as good as its enforcement; storing it without gating processing gives a false sense of compliance.
- Consent does not cover all lawful bases; some processing rests on contract or legal obligation instead.