Microsoft Clarity Consent API v2
Microsoft Clarity Consent API v2 lets Clarity adjust how it tracks visitors based on their consent choices.
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?
Depending on the visitor’s consent, Clarity behaves as follows:
- Granted: Clarity sets cookies and can track sessions across pages.
- Denied: Clarity runs in no-consent mode, without setting cookies. A new ID is generated for each page view, so sessions are not joined up.
The following parameters are used:
| Parameter | Purpose |
|---|---|
ad_Storage | Controls whether Clarity can store data related to ads |
analytics_Storage | Controls whether Clarity can store analytics-related data |
Implementation methods
HTML implementation
- Add the CookieHub script to the
<head>of your website. - Enable Clarity Consent API v2 under Integrations in your domain’s Settings tab, and click Save & publish.
- Consent signals are applied automatically when visitors accept or reject cookies.
Google Tag Manager (GTM) implementation
- Go to your GTM container.
- Add a new tag and choose the CookieHub CMP from the Community Template Gallery.
- Enter your CookieHub domain code.
- Set the trigger to Consent Initialization - All Pages.
- Save and publish.
- Enable Clarity Consent API v2 under Integrations in your domain’s Settings tab, and click Save & publish.
This ensures Clarity receives consent signals before it starts tracking.
The Consent API only takes effect when your Clarity project is set to require cookie consent. Check this in your Clarity project settings.
Parameter mapping
| CookieHub Category | Clarity Parameter |
|---|---|
| Marketing | ad_Storage |
| Analytics | analytics_Storage |
| Preferences | – (not used by Clarity) |
| Necessary | Always allowed (Clarity core functionality) |
When is Clarity Consent API v2 required?
Clarity Consent API v2 is required if:
- You use Microsoft Clarity for visitors 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
CookieHub 2.8.8 to 2.8.11 support Clarity’s original Consent API only, which Microsoft is deprecating. Upgrade to 2.8.12 or newer to use Consent API v2.
Summary
| Feature | CookieHub Support |
|---|---|
| Clarity Consent API v2 integration | ✅ Yes |
| HTML script integration | ✅ Yes |
| GTM integration with template | ✅ Yes |
| Parameter mapping to categories | ✅ Yes |