Introduction
Updated for 2026 compliance practices.
Understanding how to manage consent logs and evidence packs in a React application is a practical compliance topic for website owners validating consent, tags, and disclosures. This React consent log and evidence pack guide explains what these records are, why they matter under GDPR, and how to implement them correctly. We focus on technical implementation steps, common pitfalls, and verification using GDPRChecker scans. This guide provides technical implementation guidance, not legal advice. Always consult a qualified privacy professional for your specific situation.
When you run a React website that uses cookies, analytics, or marketing tags, you likely rely on a Consent Management Platform (CMP) to collect visitor choices. But collecting consent is only half the story. Regulators expect you to keep a detailed log of each consent action and be able to produce an evidence pack that proves your setup was compliant at the time consent was given. This guide will walk you through building that capability, testing it, and using GDPRChecker to confirm everything works as expected.
What Is a React Consent Log and Evidence Pack?
A consent log is a record of every consent decision a visitor makes on your site. It typically includes a unique identifier, timestamp, the consent choices (e.g., analytics, marketing), the version of your consent banner, and the text shown to the user. An evidence pack goes further: it bundles the consent log with a snapshot of your cookie banner configuration, your privacy policy, and proof that your tag management system respected those choices. Together, they demonstrate that you obtained valid consent and acted on it.
In a React application, consent is often managed through a CMP script loaded in your index.html or via a React wrapper. The CMP fires events when a user interacts with the banner. Your job is to capture those events, store them securely, and be able to retrieve them on request. This is not just a nice-to-have; under GDPR, the burden of proof for consent lies with the controller (Article 7(1)). An evidence pack is your best defense if a user or regulator questions your practices.
Why You Need a React Consent Log and Evidence Pack for GDPR
GDPR does not explicitly mandate a “consent log” format, but it requires you to demonstrate that consent was given (Recital 42). The European Data Protection Board (EDPB) has emphasized that controllers must be able to prove that valid consent was obtained. Without a log, you have no way to show what a specific user agreed to, when, or under which privacy policy version.
For React sites, this is especially important because client-side rendering can make it harder to track state changes. A user might give consent, then later revoke it. Your log must reflect the full history. If you use Google Consent Mode or similar, the consent state affects how tags behave. See Google's consent mode implementation guide. An evidence pack ties the consent log to the actual tag firing configuration, proving that you respected the user’s choices.
Common scenarios where a consent log is critical: - A user submits a data subject access request (DSAR) and asks for their consent history. - A regulator investigates your site and wants to see proof of consent for a specific period. - You update your cookie banner or privacy policy and need to show which version applied to past consents.
Requirements and Compliance Expectations
While there is no single technical standard, best practices and regulatory guidance point to several key requirements for a consent log and evidence pack:
- Unique identification: Each consent record should be tied to a pseudonymous identifier (e.g., a cookie or local storage key) that allows you to retrieve all consents for that user without storing personal data directly.
- Timestamp: Record the exact date and time of each consent action, including timezone.
- Consent scope: Document which purposes the user consented to (e.g., analytics, advertising, functional).
- Banner version: Include a version identifier for the consent banner and the privacy policy in effect at the time.
- Proof of presentation: Store the exact text or a hash of the banner shown, so you can prove what the user saw.
- Withdrawal records: Log when consent is withdrawn, not just when it is given.
- Security: Protect logs against tampering. Use server-side storage with access controls; client-side only logs are insufficient.
For React sites, you must also ensure that your tag manager (e.g., Google Tag Manager) respects the consent state. This is where an evidence pack becomes valuable: it should include a snapshot of your GTM container configuration or equivalent, showing that tags were set to fire only with appropriate consent.
How to Implement a Consent Log in React Step by Step
Implementing a consent log in React involves capturing consent events, storing them, and building a retrieval mechanism. Below is a step-by-step approach.
Step 1: Choose a Consent Management Platform
Most React sites use a third-party CMP. The CMP should provide a JavaScript API that fires events on consent changes. For example, many CMPs dispatch custom events like consent.onetrust or expose a callback function. If you use Google Consent Mode, the gtag('consent', 'update', {...}) call is the event you need to capture.
Step 2: Set Up Event Listeners
In your React app, you can set up event listeners in a useEffect hook in your root component or in a dedicated consent provider. Listen for the CMP’s consent event. When it fires, extract the consent state, timestamp, and any available banner version.
useEffect(() => {
const handleConsentChange = (event) => {
const consentData = {
timestamp: new Date().toISOString(),
preferences: event.detail, // adjust based on your CMP
bannerVersion: window.cmpVersion || '1.0',
};
sendConsentLogToServer(consentData);
};
window.addEventListener('consent-change', handleConsentChange);
return () => window.removeEventListener('consent-change', handleConsentChange);
}, []);Step 3: Send Consent Data to Your Server
Never rely solely on client-side storage. Implement a secure API endpoint that receives consent logs. The endpoint should validate the data, attach a server-side timestamp, and store it in a database. Use HTTPS and consider authentication to prevent spam.
Step 4: Generate a User Identifier
You need a way to link multiple consent events from the same user. A common approach is to set a first-party cookie with a random UUID when the user first visits. This cookie is not used for tracking but only for consent log association. Ensure this is disclosed in your privacy policy.
Step 5: Store Banner and Policy Versions
When you deploy a new consent banner or update your privacy policy, increment a version number. Store this version in a JavaScript variable or as a data attribute on the banner container. Your consent log should capture this version so you can later prove which text was shown.
Step 6: Build an Evidence Pack Generator
An evidence pack is a collection of documents that support a specific consent record. At minimum, it should include: - The consent log entry for that user and timestamp. - A copy of the privacy policy that was in effect at that time. - A screenshot or HTML of the consent banner as it appeared. - A configuration export from your tag manager showing consent-based triggers.
You can automate this by storing historical versions of your policy and banner in a version control system. When generating an evidence pack, retrieve the versions that match the consent log’s banner version.
Step 7: Test the Full Flow
After implementation, test thoroughly: - Accept all cookies and verify a log entry is created. - Reject all and verify a log entry is created. - Use the browser’s developer tools to simulate different consent scenarios. - Withdraw consent and check that a new log entry appears. - Request an evidence pack and confirm all documents are included.
Common Mistakes and How to Avoid Them
Many React developers make mistakes that undermine their consent log’s reliability. Here are the most common ones and how to avoid them.
Mistake 1: Logging Only on the Client Side
Storing consent logs in localStorage or IndexedDB is not sufficient. Users can clear their browser data, and you lose the proof. Always send logs to a secure server. Client-side storage can be a backup, but never the primary record.
Mistake 2: Not Logging Consent Withdrawals
GDPR gives users the right to withdraw consent at any time. If you only log initial consent, you cannot prove that a later withdrawal was honored. Your log must show the entire lifecycle.
Mistake 3: Missing Banner Versioning
If you update your consent banner without versioning, you cannot prove what a user saw. Always version your banner and policy, and include that version in the log.
Mistake 4: Ignoring Pre-Consent Network Requests
Even before consent, your React app might fire network requests (e.g., for fonts, CDN resources). Some of these could set cookies or transfer personal data. GDPRChecker scans can help verify pre-consent network requests, banner behavior, and disclosure gaps after changes. Ensure your app blocks all non-essential requests until consent is given.
Mistake 5: Not Testing the Reject Flow
Many teams test only the “Accept All” path. The “Reject All” path is equally important. Your tag manager must not fire marketing or analytics tags when consent is denied. Use GDPRChecker to scan your site with consent rejected and confirm no unauthorized tags fire.
Mistake 6: Assuming the CMP Handles Everything
A CMP collects consent, but it may not provide a durable, exportable log. You are responsible for storing the evidence. Do not assume your CMP’s dashboard is enough; you need your own records.
How to Validate Your Setup with GDPRChecker
GDPRChecker provides scans that help you verify your consent implementation and evidence pack readiness. Here’s how to use it effectively.
Pre-Consent Scan
Run a scan of your React site without interacting with the consent banner. GDPRChecker will list all network requests, cookies, and potential data transfers that occur before consent. This helps you identify tags firing too early. Fix any issues and rescan until the pre-consent state is clean.
Post-Consent Scan
After accepting or rejecting consent, run another scan. Verify that the tags and cookies match the consent choice. For example, with consent rejected, Google Analytics should not load. GDPRChecker highlights discrepancies so you can adjust your tag triggers.
Banner Behavior Check
GDPRChecker can simulate user interactions with your banner. It checks whether the banner appears correctly, whether the reject option is easily accessible, and whether consent is properly recorded. Use this to catch design flaws that might invalidate consent.
Evidence Pack Validation
While GDPRChecker does not generate evidence packs, it can help you validate the technical aspects. After you implement your log, use the scanner to confirm that consent states are correctly reflected in tag behavior. This gives you confidence that your evidence pack will match reality.
For a deeper dive into related topics, see our guides on Google Consent Mode v2 and cookie banner requirements. If you use Google Analytics, our Google Analytics GDPR compliance guide is essential reading.
Implementation Checklist
Use this checklist to ensure your React consent log and evidence pack are complete:
- Select a CMP that provides a consent change event or callback.
- Implement a server-side endpoint to receive consent logs.
- Generate a pseudonymous user identifier (e.g., first-party cookie) for log association.
- Capture consent events in a React
useEffector consent provider. - Include timestamp, consent preferences, banner version, and policy version in each log entry.
- Log both consent grants and withdrawals.
- Store historical versions of your consent banner and privacy policy.
- Build an evidence pack generator that bundles log entries with relevant policy and banner versions.
- Test the full flow: accept, reject, withdraw, and request evidence pack.
- Run a GDPRChecker pre-consent scan and fix any unauthorized requests.
- Run a GDPRChecker post-consent scan with both accept and reject scenarios.
- Document your consent log retention period and security measures.
FAQ
What is React consent log and evidence pack guide?
This guide explains how to implement and maintain a consent log and evidence pack in a React application. It covers capturing consent events, storing them securely, and generating proof of compliance for GDPR. It is a practical resource for website owners validating consent, tags, and disclosures.
Do I need React consent log and evidence pack guide for GDPR?
Yes, if your React site collects consent for cookies or tracking, you need a consent log and evidence pack to demonstrate compliance. GDPR requires you to prove that valid consent was obtained. This guide helps you build that capability.
How do I implement React consent log and evidence pack guide?
Implement by listening for consent events from your CMP, sending data to a secure server, versioning your banner and policy, and building a retrieval system. Follow the step-by-step instructions in this guide, and test thoroughly with both accept and reject flows.
How can I verify React consent log and evidence pack guide with a scanner?
Use GDPRChecker to scan your site before and after consent. It checks for pre-consent network requests, tag behavior, and banner functionality. This validates that your implementation respects user choices and that your evidence pack will be accurate.
What are common React consent log and evidence pack guide mistakes?
Common mistakes include storing logs only client-side, not logging withdrawals, missing banner versioning, ignoring pre-consent requests, and not testing the reject flow. Avoid these by following the best practices and checklist in this guide.
Next Steps for Your React Consent Compliance
Building a robust consent log and evidence pack is a critical step in GDPR compliance for any React website. It protects you in case of audits and builds trust with your users. Start by auditing your current consent flow with GDPRChecker. Identify gaps in pre-consent requests and tag firing. Then implement the logging mechanism described here, ensuring every consent action is recorded and retrievable.
Remember, this React consent log and evidence pack guide provides technical implementation guidance, not legal advice. Always work with a privacy professional to tailor your approach to your specific context. For more help, explore our related guides on Google Consent Mode v2 vs Google Certified CMP and whether you need a CMP if you don't run Google Ads.
Ready to verify your setup? Run a GDPRChecker scan today and close the consent gap.
Copyright and editorial notice
© GDPRChecker
This original AI-assisted editorial draft was selected, reviewed, and published by GDPRChecker. All rights are reserved where protected by applicable law. Do not reproduce the article without permission.