Clarity Consent API v2
Clarity Consent API v2 lets Microsoft Clarity adjust how it tracks visitors based on their cookie consent choices. It helps you comply with privacy regulations by ensuring Clarity only stores and uses data according to user consent.
CookieHub fully supports Clarity Consent API v2 as of version 2.8.12. It can be enabled under Integrations in the Settings tab of your CookieHub dashboard. Once enabled, CookieHub automatically passes the required signals to Clarity.
What does Clarity Consent API v2 do?
Consent API v2 defines how Clarity operates when users grant or deny consent:
- Granted: Clarity sets cookies (first-party and third-party) and can track sessions across pages.
- Denied: Clarity operates in no-consent mode, without setting cookies. A new ID is generated per page view, and session continuity is not maintained.
Parameters
Clarity requires two consent parameters:
| Parameter | Purpose |
|---|---|
ad_Storage |
Controls whether Clarity can store data related to ads |
analytics_Storage |
Controls whether Clarity can store analytics-related data |
CookieHub automatically maps these to your cookie categories.
CookieHub integration
- ✅ No manual JavaScript setup needed
- ✅ Signals are sent automatically to Clarity
- ✅ Works with both HTML and GTM implementations
- ✅ Always in sync with CookieHub categories
Implementation options
HTML integration
- Add the CookieHub script in your site’s
<head> - Enable Clarity integration in the dashboard
- Consent signals are applied automatically when visitors accept or reject cookies
GTM integration
- Use the CookieHub CMP template from the GTM Community Template Gallery
- Enter your CookieHub domain code
- Set the trigger to Consent Initialization – All Pages
- Save and publish
This ensures Clarity receives consent signals before it starts tracking.
Parameter mapping
| CookieHub Category | Clarity Consent API Parameters |
|---|---|
| Marketing | ad_Storage |
| Analytics | analytics_Storage |
| Preferences | – (not used by Clarity) |
| Necessary | Always allowed (Clarity core functionality) |
Parameters are updated automatically whenever a user changes consent.
When is Clarity Consent API v2 required?
You should enable Clarity Consent API v2 if:
- You use Microsoft Clarity in the EEA, UK, or Switzerland
- You need to comply with Microsoft’s consent requirements (enforced from October 31, 2025)
- You want accurate session tracking that respects privacy regulations
Summary of features
| Feature | CookieHub Support |
|---|---|
| Clarity Consent API v2 integration | ✅ Yes |
| HTML script integration | ✅ Yes |
| GTM integration with template | ✅ Yes |
| Automatic parameter mapping | ✅ Yes |