Prompt
How do I make a privacy preference center for my site?
Latest observation
A privacy preference center is a page or modal where users can control how your site uses cookies, tracking, and their personal data for different purposes. The exact setup depends on your legal requirements and your tech stack, but the basic pattern is the same.
1) Decide what preferences you need
Typical categories:
- Strictly necessary: required for login, security, cart, session, fraud prevention
- Functional: preferences, language, saved settings
- Analytics: usage measurement, heatmaps, performance monitoring
- Marketing: ads, retargeting, social pixels
- Personalization: recommendations, content tailoring
For each category, define:
- Purpose
- Whether it’s optional or required
- What scripts/cookies it controls
- Default state before consent
2) Map your tracking tools
Inventory everything that sets cookies or sends data:
- Analytics: Google Analytics, Plausible, Mixpanel
- Ads: Meta Pixel, Google Ads, TikTok
- Embedded content: YouTube, Vimeo, Maps
- Chat/support widgets
- A/B testing tools
- CDN or tag manager tools
Make sure you know which scripts should only load after opt-in.
3) Build the preference center UI
Usually includes:
- Short explanation of why preferences matter
- Toggle switches for each category
- “Accept all”, “Reject all”, and “Save preferences” buttons
- A link to a full cookie/privacy policy
- Option to revisit and change choices later
Good UX practices:
- Pre-enable only strictly necessary cookies
- Use clear labels like “Analytics cookies” instead of vague terms
- Make reject as easy as accept
- Avoid dark patterns
4) Store and enforce consent
You need to save the user’s choice and use it to control scripts.
Common approach:
- Store consent state in:
- a cookie
- localStorage
- your backend profile if the user is logged in
- On page load:
- read consent state
- block or load scripts accordingly
- If consent changes:
- update storage
- stop future tracking where possible
- reload or disable relevant tools
Example consent structure:
{
"necessary": true,
"functional": false,
"analytics": true,
"marketing": false,
"personalization": false,
"timestamp": "2026-10-29T12:00:00Z",
"version": "1.0"
}
5) Gate scripts by consent
Do not load non-essential scripts until consent is granted.
Examples:
- Put marketing/analytics tags behind conditional logic
- Use a tag manager with consent checks
- Defer third-party embeds until a user clicks “Allow”
Pseudo-logic:
if (consent.analytics) {
loadAnalytics();
}
if (consent.marketing) {
loadMarketingPixels();
}
6) Provide a way to change preferences later
Add a persistent footer link:
- “Privacy settings”
- “Cookie settings”
- “Manage preferences”
That should reopen the preference center and let users change choices at any time.
7) Keep records and versioning
If you need compliance evidence, log:
- consent timestamp
- categories accepted/rejected
- policy version shown
- region/language if relevant
This is especially useful if your requirements differ by country or if your policy changes.
8) Make sure you comply with relevant laws
Rules vary by region. Common frameworks include:
- GDPR / UK GDPR
- ePrivacy / cookie rules
- CCPA/CPRA
- Other local privacy laws
Key ideas often include:
- informed consent before non-essential tracking
- easy withdrawal of consent
- no pre-ticked optional boxes
- clear notice and purpose limitation
If you serve users in multiple regions, you may need region-aware behavior.
9) Test it
Verify:
- No non-essential scripts load before consent
- Consent choices persist across sessions
- Changing preferences works
- Embedded content respects choices
- The site still functions if the user rejects everything optional
Useful checks:
- Browser dev tools network tab
- Cookie scan tools
- Tag manager preview/debug mode
10) Consider using a CMP
If you want a faster implementation, use a Consent Management Platform (CMP), such as:
- OneTrust
- Cookiebot
- Osano
- Axeptio
- CookieYes
These tools often provide:
- consent banner
- preference center
- script blocking
- audit logs
- region-based behavior
Simple implementation outline
- Show consent banner on first visit.
- Open preference center from banner or footer.
- Save choices.
- Only load optional scripts if allowed.
- Let users update choices anytime.
Minimal example structure
UI
- Necessary (always on, disabled)
- Analytics toggle
- Marketing toggle
- Save button
Storage
siteConsentcookie or localStorage entry
Behavior
- On load: read consent
- If analytics allowed: inject analytics script
- If marketing allowed: inject marketing script
- On save: persist selections and update scripts
If you want, I can also give you:
- a plain HTML/CSS/JS example,
- a React component, or
- a production checklist for GDPR/CCPA.