If you use the Clarity plugin it will be configured automatically, if you want to add it manually then read this article.
Summary
Microsoft Clarity’s Consent API – ConsentV2 is the updated method for passing cookie‐consent signals to Clarity. Beginning 31 October 2025, Clarity will require a valid consent signal for visits from the EEA, UK and Switzerland. ConsentV2 replaces the older API and provides more granular control: for both ad_storage and analytics_storage you can indicate whether consent is granted or denied. In practice, this means that until you pass a consentv2 call, Clarity will operate in a “no-consent” mode (with limited tracking, no first-party/third-party cookies).
If you use the Complianz plugin on WordPress (or a site using Complianz), you can enable this consent handling during the wizard setup when integrating Clarity. This ensures that Clarity’s tracking aligns with user consent and regional requirements.
How to enable it in Complianz when adding Clarity in the wizard
If you are a Complianz user (for instance on WordPress) you can integrate Clarity Consent Mode V2 via the setup wizard. Here’s how:
-
Install and activate the Complianz plugin.
-
Launch the Complianz setup wizard.
-
When you reach the Statistics section (often labelled something like “Do you compile statistics of this website?”) you’ll choose that you do use analytics/statistics tools. For Clarity specifically, you’ll indicate that you use Clarity.
-
In the Statistics Configuration step (or similar), you’ll see an option for enabling Consent Mode / Consent V2 when you choose to ask consent for statistics. It will be enabled by default.
-
Input the required values for Clarity integration (e.g., your Clarity project ID) and ensure that the plugin sends the correct consent signals when the user gives or refuses consent.
-
Save and complete the wizard. At that point, Complianz will manage the banner, consent capture, and signal propagation to Clarity. It will handle the blocking of scripts until consent (if configured) and fire the proper
window.clarity('consentv2', {...})call when consent is given.
What is Consent Mode V2 for Clarity?
Here are the key elements:
What it does
-
The API call looks like:
window.clarity('consentv2', {
ad_Storage: "granted" | "denied",
analytics_Storage: "granted" | "denied"
});
-
If a user grants both analytics and ad storage, Clarity is allowed to set first‐ and third‐party cookies and track across sessions.
-
If the user denies consent (for one or both types), Clarity will track in a “no-consent” mode: it assigns a unique ID per page view, but does not set cookies.
-
Importantly: this is required (for Clarity features to function fully) for visitors from EEA, UK, Switzerland starting 31 October 2025.
-
The previous method
window.clarity('consent', true/false)is deprecated; ConsentV2 is the recommended method.
Why it matters
-
From a compliance standpoint: Many regions require cookie consent (for analytics, marketing) before tracking kicks in. By correctly using ConsentV2, you ensure Clarity respects those choices.
-
From an analytics standpoint: Without proper consent signalling, you may lose data, affect session stitching, or incur risks of non-compliance.
-
From an implementation standpoint: It simplifies how Clarity handles consent (rather than ad-hoc custom scripts) and aligns with evolving regulation (or enforcement) in the EU/UK/Switzerland.
Debugging Clarity Consent Mode
Add below code in your browser console and check to see if all consent states change correctly,/p>
// Map Complianz -> Clarity consentv2 and (optionally) clear cookies on full deny
(function () {
function status(b){ return b ? 'granted' : 'denied'; }
function pushToClarity() {
var analytics = !!cmplz_has_consent('statistics');
var ads = !!cmplz_has_consent('marketing');
// Clarity Consent Mode v2
window.clarity('consentv2', {
analytics_Storage: status(analytics),
ad_Storage: status(ads)
});
// Optional: if user denied everything, also wipe Clarity cookies/session
if (!analytics && !ads) window.clarity('consent', false);
console.log('[Clarity] consentv2 ->', {analytics, ads});
}
// Fire once now
pushToClarity();
// Re-fire whenever Complianz says consent changed
document.addEventListener('cmplz_status_change', pushToClarity); // Complianz emits this on changes
})();
