Skip to content
Start free Sign in

Microsoft Clarity Consent Mode

Last updated

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 it is on, Kukie.io sends each visitor's choice to Clarity as it is made: Analytics sets analytics_Storage and Marketing sets ad_Storage. When a choice leaves both off, Kukie.io also tells Clarity to erase its cookies. It is one switch in the Banner Editor, with no code changes.

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.io does not install Clarity for you. Add the Clarity tracking code to your site separately. If Clarity has not loaded yet when a signal is sent, Kukie.io puts the signal in Clarity's own command queue, and Clarity reads it when it loads. With Auto-block Scripts on, Clarity is held until the visitor accepts Analytics.

How to Enable

  1. Go to your site in the Kukie dashboard
  2. Open the Banner Editor
  3. Navigate to the Integrations tab
  4. On the Microsoft Clarity card, turn on Enable Clarity consent signals
  5. Select Save configuration to publish your banner

Clarity waits for a consent signal before it sets cookies only when Consent Mode is on in your Clarity project. Without it, Clarity can set its cookies before the visitor makes a choice.

  1. Sign in to Microsoft Clarity (opens in a new tab) and open your project.
  2. Go to Settings, then Setup.
  3. Turn off the setting that lets Clarity set cookies by default. Clarity then waits for a consent signal before it sets any cookie.

Clarity turns Consent Mode on by itself for visitors from the EEA, the UK and Switzerland. Turning it on for the whole project means every visitor's choice counts the same way.

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 choice leaves both Analytics and Marketing off, for example Reject all, Kukie.io first calls window.clarity('consent', false) to erase Clarity's cookies, then sends both signals as denied. A later change of mind in the banner works the same way, on the same page.

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. Clarity receives the saved choice as its only signal on that page, not a default followed by the saved choice.

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's script loaded: in the Network tab, filter for clarity.ms and look for the tag's request
  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

To see the consent state Clarity holds, paste this into the Console once Clarity has loaded:

clarity('metadata', (d, upgrade, consent) => {
    console.log('consentStatus:', consent);
}, false, true, true);

Before a choice on an opt-in site, both values read DENIED. This step needs Auto-block Scripts off, because with it on Clarity loads only after the visitor accepts Analytics. After Accept all, both read GRANTED. After a choice that accepts Analytics only, analytics_storage reads GRANTED and ad_storage reads DENIED.

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

Signals sent before Clarity loads wait in Clarity's command queue, so the order in which the two scripts load does not matter. If Clarity never loads, nothing reads the queue: check that the Clarity tracking code is on the page, and, with Auto-block Scripts on, that the visitor has accepted Analytics.

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.

Follow this guide in your own account

Create a free account to follow this guide: add your site, scan it for cookies and publish your consent banner.

Start free

Kukie.io provides tools to collect and record consent. It is not legal advice, and using it does not by itself make a website compliant with any law.

Was this helpful?

Listed on