Skip to content

Documentation

Microsoft Clarity Consent Mode

Microsoft Clarity Consent Mode

Last updated Mar 29, 2026

Kukie can automatically send consent signals to Microsoft Clarity when visitors accept or deny cookies on your site. This integration uses the Clarity Consent API v2, so Clarity respects your users' privacy choices without any custom code on your part.

Overview

When enabled, Kukie detects Microsoft Clarity on your page and forwards consent decisions in real time. Clarity will only store ad-related and analytics data when your visitors have given consent. If a visitor denies cookies, Kukie tells Clarity to erase its cookies and stop collecting data. One toggle in the Kukie dashboard - no code changes needed.

Prerequisites

Before you enable this integration, make sure you have:

  • A Kukie account with at least one verified site
  • The Microsoft Clarity tracking code installed on your site (separately from Kukie)
  • The Kukie banner script installed and working on the same site

Tip: Kukie does not install Clarity for you. You need to add the Clarity tracking code to your site separately. Kukie only sends consent signals to Clarity once it detects the window.clarity function on the page.

How to Enable

  1. Go to your site in the Kukie dashboard
  2. Open the Banner Editor
  3. Navigate to the Integrations tab
  4. Toggle on Microsoft Clarity Consent
  5. Click Save to publish your banner

Note: After enabling this integration, your banner script bundle will be regenerated automatically. The new version may take a few minutes to propagate through the CDN.

How It Works

Kukie communicates with Clarity at three key moments:

On page load, Kukie sets Clarity consent defaults based on your site's consent model. For opt-in sites (GDPR), both parameters start as denied. For opt-out (CCPA) or notice-only sites, both start as granted.

User Accepts Cookies

When a visitor clicks "Accept", Kukie calls:

window.clarity('consentv2', {
    ad_Storage: 'granted',
    analytics_Storage: 'granted'
});

Clarity then begins (or continues) collecting session data normally.

User Denies Cookies

When a visitor clicks "Deny", Kukie first calls window.clarity('consent', false) to erase any existing Clarity cookies, then sends the denied state. This ensures no tracking data persists after denial.

Returning Visitors

For visitors who have already made a consent choice, Kukie restores their saved preference and sends the appropriate signal to Clarity on page load - no banner interaction required.

Kukie Category Clarity Parameter Description
Marketing ad_Storage Controls whether Clarity can store ad-related data
Analytics analytics_Storage Controls whether Clarity can store analytics data

The integration behaves differently depending on your site's consent model:

Consent Model Default State On Accept On Deny
Opt-in (GDPR) Both denied Both granted Both denied + cookies erased
Opt-out (CCPA) Both granted N/A Both denied + cookies erased
Notice only Both granted N/A (implied) N/A

Testing the Integration

To verify the integration is working correctly:

  1. Open your site with the browser DevTools Console open
  2. Check that Clarity is loaded: typeof window.clarity should return 'function'
  3. Check that the integration is enabled: window.__KUKIE_CONFIG__.integrations.clarity_consent should return true
  4. Accept cookies via the banner, then check Application > Cookies for _clck and _clsk
  5. Clear your consent (or use a private window), deny cookies, and verify those Clarity cookies are removed

You can also monitor the exact calls Kukie makes to Clarity by pasting this snippet into the Console before interacting with the banner:

// Monitor Clarity consent calls
const origClarity = window.clarity;
window.clarity = function(...args) {
    console.log('[Kukie->Clarity]', ...args);
    return origClarity?.apply(this, args);
};

Troubleshooting

Kukie checks for window.clarity before sending any signals. If the Clarity tracking code is not installed on your site, or loads after the Kukie banner script, signals will not be sent. Make sure the Clarity snippet is present in your page's <head>.

Clarity cookies appear even after deny

This usually happens when Clarity is loaded more than once on the page. Check your browser Console for the message Error CL001: Multiple Clarity tags detected. Remove any duplicate Clarity snippets so only one instance runs.

Consent signals are sent but Clarity dashboard shows no data

Clarity processes session data asynchronously. It can take up to 2 hours for new sessions to appear in the Clarity dashboard. Wait and check again.

Was this helpful?

Listed On