The PostHog Cookie Consent Component is a plug-and-play solution for managing user consent with full control over its look and behavior. Every aspect (colors, text, layout, and behavior) can be adjusted through component properties, allowing you to perfectly match your brand's style without extra coding.
This component includes two versions:
📌 VERSION 1: LEGACY • Add your PostHog snippet to Site Settings → Custom Code → End of <head> • The banner manages consent only. PostHog loads independently. • Accept → full tracking with persistent cookies (localStorage+cookie) • Reject → PostHog switches to memory-only persistence. Events are collected during the current session but no cookies or localStorage data is stored. Each new session generates a different user ID, ensuring no cross-session tracking.
📌 VERSION 2: COOKIELESS (Recommended) • Paste your PostHog snippet directly into the component's property panel. No custom code needed in Site Settings. • The component loads PostHog for you with built-in cookieless tracking. • Before consent: anonymous pageviews via privacy-preserving server-side hash (no cookies, no localStorage) • Accept → full tracking with persistent cookies • Reject → cookieless anonymous counting continues • Requires enabling "Cookieless server hash mode" in PostHog → Project Settings → Web Analytics
🔧 SETUP
Copy the component into your project
Add it to a shared layer visible on every page (e.g. footer or fixed overlay)
For V1: add PostHog snippet to Site Settings → Custom Code For V2: paste PostHog snippet into the component's "PostHog Init Code" field
Customize text, buttons, colors, and layout via the property panel
✅ KEY FEATURES • Fully customizable design (colors, fonts, padding, borders, shadows) • Responsive layout that stacks vertically on mobile • Privacy policy link support • Framer preview mode detection so the banner is always visible in editor • PostHog opt_in/opt_out capturing for strict consent management
⚠️ IMPORTANT NOTE: In V1 (Legacy), when users reject cookies, PostHog continues collecting analytics during the current session but with memory-only persistence. No cookies are stored and each new session gets a different user ID, ensuring no cross-session tracking. In V2 (Cookieless), reject switches to anonymous cookieless tracking via a server-side hash. No cookies, no localStorage, no persistent user identification.
⚠️ DISCLAIMER: This cookie consent banner is provided as-is for general use. While designed to support GDPR/KVKK compliance, users are responsible for ensuring their specific implementation meets all applicable privacy regulations in their jurisdiction. We recommend consulting with legal professionals for compliance verification.
⚠️ LIMITATION OF LIABILITY: No responsibility is accepted for any legal, compliance, or operational issues arising from the use of this component. Users assume full responsibility for any consequences resulting from implementation and usage.
⚠️ Refund Policy: Due to the nature of Code components being digital products, they are not refundable. Please review the template details and features carefully before purchasing.