Cookie Consent and Tracking Compliance Playbook
Version 1.0 | Prepared by Sherlock, AI by Trailblazer Labs
Purpose : This playbook provides a step-by-step framework for implementing and maintaining compliant cookie consent and tracking mechanisms under GDPR, ePrivacy Directive (and upcoming ePrivacy Regulation), and related frameworks like CCPA/CPRA. It ensures lawful processing of personal data via trackers, ads, and analytics. Tailor to your jurisdiction, tech stack (e.g., Google Tag Manager - GTM, Google Analytics 4 - GA4), and CMP (e.g., OneTrust, Cookiebot, Quantcast).
Key Principles :
Legitimate Interest : Use only for strictly necessary cookies (e.g., session, security). No consent needed.
Granular Consent : Separate opt-in for categories (e.g., analytics, marketing, social).
Easy Withdrawal : "Reject All" button, toggleable banners, 6-month refresh.
Prior-Block : Block trackers until consent; no "scan & load."
Transparency : Clear banner text, cookie policy link.
1. ePrivacy/GDPR Consent Requirements
Legal Foundations
Requirement GDPR/ePrivacy Details Implementation Notes Scope Applies to EU/EEA users (GDPR); cookies/trackers (ePrivacy). Detect geo via IP (e.g., MaxMind) or navigator.language. Show banner if EU. Consent Validity Freely given, specific, informed, unambiguous (Art. 4(11) GDPR). No pre-ticked boxes. Granular toggles; "Accept All" optional but "Reject All" mandatory. Categories Essential (exempt); Functional; Analytics/Performance; Marketing/Ads; Social Media. Map to IAB TCF purposes (e.g., 1=Storage, 7=Measurement). Storage/Access Consent before set/read (e.g., no localStorage pre-consent). Use CMP to gate document.cookie, localStorage. Children Verifiable parental consent under 16 (or lower). Age gate if targeting kids. Duration 6-12 months max; refresh on return. CMP auto-refresh. Records Prove consent (Art. 7 GDPR). Log timestamps, choices, IP, user-agent.
Best Practices :
Banner text: "We use cookies for [purposes]. Manage preferences or [Reject All]. [Accept All]."
Link to policy: Detail vendors, durations, purposes.
No dark patterns: Equal prominence for accept/reject.
2. CMP Configuration (TCF/GPP)
CMP Selection : Choose TCF v2.2 certified (IAB Tech Lab) with GPP support for global (e.g., US states).
TCF v2.2 Setup
Stack : CMP → tcString → GVL (Global Vendor List) → Vendors.
Configuration Checklist :
Parameter Value Notes tcPurposeConsentsBit-field (e.g., 1=Consent, 7=LegInt). Enable LegInt for analytics if documented LIA. tcVendorConsentsVendor IDs from GVL. Auto-map via CMP dashboard (e.g., Google=755). purposeOneTreatment1 for LegInt-only.For info society services. publisherRestrictionsBlock high-risk vendors. Enforce no-sale for CCPA. Event Listeners __tcfapi('addEventListener', 2, listener)Fire on 'tcloaded'/'useractioncomplete'.
GPP (Global Privacy Platform) Setup
For US/global: Section 1 (TCFv2), 2 (US privacy string), 3 (Custom).
String: CP<<hex-encoded>>
Config: Enable USPAPI (__uspapi), GPP (__gpp) alongside TCF.
CMP Integration :
Embed CMP script first (head).
Update GVL weekly via CMP.
Test: Use IAB TCF Test Page or /cmp_status endpoint.
3. Consent Mode and Tag Governance
Google Consent Mode v2 (GA4/GTM/Ads)
Signals : ad_storage, analytics_storage, ad_user_data, ad_personalization, functionality_storage, personalization_storage, security_storage.
Default State : 'denied' until consent.
Implementation :
javascript Copy code
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
'ad_storage': 'denied',
'analytics_storage': 'denied',
// etc.
});
// On consent update:
gtag('consent', 'update', {
'ad_storage': consent ? 'granted' : 'denied'
});
Advanced : ad_user_data: 'denied' for EEA (no PII in ads).
Tag Governance (GTM/Server-Side)
GTM Container Setup :
Workspace: Prod/Dev.
Folders: CMP Signals → Consent Checks → Tags (Analytics → Marketing).
Triggers: Consent granted (DL variable == 'granted').
Tag Firing Rules :
Tag Type Trigger Condition GA4 analytics_storage == 'granted'Floodlight ad_storage == 'granted'Facebook Pixel Marketing consent + vendor consent
Server-Side GTM (sGTM) : Proxy tags; enforce consent server-side.
Governance :
Approval workflows in GTM.
Version control: Tag fingerprints.
Quarterly reviews: Remove unused tags.
4. Data Layer Signals
Standardize Data Layer (GTM/Tealium):
javascript Copy code
dataLayer.push({
'event': 'consent_updated',
'consent_status': {
analytics: 'granted/denied',
marketing: 'granted/denied',
// Map to CMP tcString
},
'tcString': '...', // Full TCF string
'gppString': '...', // GPP string
'tcfApiVersion': '2.2'
});
Variables : GTM DL vars for {{analytics_consent}}.
Pushes :
On load: Defaults.
On update: From CMP listener.
Validation : Schema enforcement (e.g., JSON Schema).
5. Audits/Logging
Audit Framework
Audit Type Frequency Tools/Checks Self-Audit Monthly Cookiebot Scanner, TAG Assistant, /cookies endpoint. External Annually CookieYes, TRUSTe; check no pre-consent trackers. Vendor Quarterly CMP dashboard: Consent rates >70%; rejects logged. Regression Post-deploy Replay user journeys (e.g., BrowserStack).
Logging
CMP Logs : Store tcString, timestamp, IP hash, user-agent (GDPR Art.7).
Retention : 12 months; anonymize after.
Tools : BigQuery/Snowflake for queries (e.g., SELECT * WHERE consent='denied').
Alerts : Slack/Email on <50% consent rate.
6. Enforcement
Technical : CMP blocks via Blocking API (e.g., OneTrust).
Fallbacks : if (!consent) return;
Non-Compliance : Graceful degradation (e.g., server-side fallbacks).
Penalties : Document LIA for LegInt; monitor CNIL/ICO fines (€20M+).
Global : GPP for US; fcapi for first-party.
7. Rollout and QA Steps
Rollout Phases
Planning (1-2 weeks) :
Map all tags/vendors.
Legal review banner/policy.
Procure CMP license.
Development (2-4 weeks) :
Integrate CMP + Consent Mode.
Configure GTM tags/triggers.
Data layer schema.
Staging Deploy :
Mirror prod env.
Preview GTM mode.
Production Rollout :
Canary: 10% traffic.
Full: Monitor 24h.
A/B test banner UX.
QA Checklist
Step Test Case Pass Criteria Tools Banner Load on EU IP; toggles work. No trackers pre-consent; reject blocks. DevTools Network tab. Consent Signals Update → DL push → tag fire. GA4 pings only on grant. GTM Preview, Consent Mode Debugger. TCF/GPP __tcfapi('getTCData').Valid tcString; vendor consents match. TCFv2 Playground. Edge Cases Reject all; incognito; VPN; mobile. 100% block; no localStorage. BrowserStack. Performance TTI <2s; no CLS. Lighthouse score >90. Web Vitals. Cross-Browser Chrome/FF/Safari/Edge. Consistent. Matrix. Regression Post-deploy scan. Zero violations. CAPI Tester.
Post-Rollout :
Monitor: Consent rates, bounce rates.
Iterate: A/B banners quarterly.
Train: Team playbook access.
Resources :
Contact : For custom audits, reply with site URL. Stay compliant! 🕵️♂️