Prompt
How do I manage consent for advertising and analytics cookies separately?
Latest observation
Oct 29, 2026
OpenAI APIWeb search: off
To manage advertising and analytics cookies separately, use granular cookie consent with distinct categories and only load each tool after the user opts in.
1) Split cookies into categories
Common categories:
- Necessary: always on; required for site to function
- Analytics: tracking usage/statistics
- Advertising/Marketing: ad personalization, remarketing, attribution
- Preferences: language, UI settings
2) Ask for separate consent
Your cookie banner should let users choose:
- Accept all
- Reject non-essential
- Customize settings
- Toggle Analytics independently from Advertising
Example:
- Analytics cookies
- Advertising cookies
3) Default to off for non-essential cookies
Before consent:
- Do not set analytics or ad cookies
- Do not load analytics/ad scripts
- Do not fire pixels or tags
- Do not share data with ad platforms
4) Load scripts only after consent
Implement consent gating:
- If analytics consent = true → load GA/Matomo/other analytics
- If advertising consent = true → load Meta Pixel, Google Ads, TikTok Pixel, etc.
5) Store consent by category
Save the user’s choices in a consent record, e.g.:
{
"necessary": true,
"analytics": false,
"advertising": true,
"updatedAt": "2026-10-29T00:00:00Z"
}
Store this in a consent cookie/local storage or in your consent management platform.
6) Let users change their mind later
Provide a “Cookie settings” link in the footer so users can:
- Review choices
- Turn categories on/off
- Withdraw consent easily
7) Respect regional requirements
Depending on your audience, laws like GDPR/ePrivacy or CCPA/CPRA may require:
- Explicit opt-in for analytics/advertising in some regions
- Easy withdrawal of consent
- Proof of consent
- No pre-ticked boxes for non-essential cookies
8) Use a CMP if needed
A Consent Management Platform (CMP) can handle this for you, such as:
- OneTrust
- Cookiebot
- Didomi
- Osano
These tools often support category-based consent and tag blocking.
9) Example implementation pattern
Pseudo-flow:
- User lands on site
- Show banner with category choices
- Save preferences
- If analytics enabled → initialize analytics
- If advertising enabled → initialize ad tags
If you want, I can also give you:
- a plain JavaScript example
- a Google Tag Manager setup
- or a GDPR-compliant consent banner structure