Skip to Content

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.


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:

ParameterPurpose
ad_StorageControls whether Clarity can store data related to ads
analytics_StorageControls whether Clarity can store analytics-related data

Implementation methods

HTML implementation

  1. Add the CookieHub script to the <head> of your website.
  2. Enable Clarity Consent API v2 under Integrations in your domain’s Settings tab, and click Save & publish.
  3. Consent signals are applied automatically when visitors accept or reject cookies.

Google Tag Manager (GTM) implementation

  1. Go to your GTM container.
  2. Add a new tag and choose the CookieHub CMP from the Community Template Gallery.
  3. Enter your CookieHub domain code.
  4. Set the trigger to Consent Initialization - All Pages.
  5. Save and publish.
  6. 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 CategoryClarity Parameter
Marketingad_Storage
Analyticsanalytics_Storage
Preferences– (not used by Clarity)
NecessaryAlways allowed (Clarity core functionality)

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

FeatureCookieHub Support
Clarity Consent API v2 integration✅ Yes
HTML script integration✅ Yes
GTM integration with template✅ Yes
Parameter mapping to categories✅ Yes

Last updated on