Skip to content

Cookie consent

Microsoft Clarity and cookie consent: how to set it up

By the Kiescy teamUpdated 5 min readChecked against the official text on

Microsoft Clarity is a free tool that records heatmaps and session replays: you see where visitors click, scroll and get stuck. Because it records behaviour and sets cookies, it's one of the trackers a cookie banner has to handle.

Since 31 October 2025, Clarity itself enforces consent for visitors from the EU, UK and Switzerland. This guide explains what that means, the current code, and how to connect Clarity to your banner so you still get data from visitors who agree.

The short version

Yes. Clarity sets cookies and records how visitors use your site, so EU, UK and Swiss visitors must agree first. Since 31 October 2025, Clarity waits for a consent signal from those visitors before setting cookies; without one, it collects only limited data. Send consent with clarity('consentv2', { ad_Storage, analytics_Storage }), or use a banner that sends Google Consent Mode signals, which Clarity also reads.

Words you'll see in this guide (4)
Session replay:
A video-like reconstruction of one visitor's visit: mouse moves, clicks and scrolls.
Heatmap:
A picture of a page coloured by where visitors click or how far they scroll.
Consent API v2:
Clarity's current way to pass consent: clarity('consentv2', {...}) with ad_Storage and analytics_Storage. The older clarity('consent') call is deprecated.
Google Consent Mode:
Google's consent signals (analytics_storage, ad_storage and more). Clarity reads them too, so one banner can tell both.
On this page
  1. Does it need consent
  2. Set it up
  3. Withdrawing consent
  4. Clarity cookies
  5. Masking and policy
  6. Test it
  7. Questions
  8. Sources

Does Microsoft Clarity need cookie consent?

Clarity's cookies are for analytics, not something the visitor needs, so under the EU and UK cookie rules (ePrivacy Article 5(3) and PECR) they need consent. Session replay also records how a person uses your site, which is personal data under the GDPR.

Visitors fromWhat Clarity does without a consent signal
EU/EEA, UK, SwitzerlandSince 31 October 2025, waits for a valid consent signal before setting cookies; without consent, no cookies and only limited data
Everywhere elseRuns normally by default; you can still turn consent mode on for all visitors in Clarity's settings

That change protects you from setting cookies too early, but it also means a Clarity project with no banner connection collects much less from European visitors. The fix isn't to switch it off; it's to pass your visitors' choice to Clarity.

Example

An online furniture shop in Amsterdam added Clarity in 2024 and saw recordings drop sharply in November 2025. Nothing was broken: Clarity had started waiting for consent. Once the banner passed analytics consent to Clarity, recordings came back for visitors who accepted.

How to connect Clarity to your consent banner

Diagram: the page loads with the analytics script in the head, the consent banner holds it back with no cookies or requests. If the visitor allows the category, the script runs and cookies are set. If they reject, the script never runs and nothing is sent to the vendor.Page loadsPixel / analytics script in <head>Consent banner holds it backScript waits, no cookies, no requestAllows categoryScript runsRejectsScript never runsCookies such as _ga or_fbp are set from hereNo tracker cookies,nothing sent to the vendor
A blocking banner keeps Clarity's script off the page until analytics is allowed.

1. With Kiescy

Kiescy blocks clarity.ms in the analytics category by default, so Clarity's script doesn't load until the visitor allows analytics. Kiescy also sends Google Consent Mode updates, which Clarity reads, so once the script loads it sees analytics_storage granted. Put Kiescy's script first in <head>; nothing else is needed.

2. Call the Consent API v2

If your banner can run code when the visitor chooses, pass both values. Microsoft's documentation says both keys are required:

Clarity Consent API v2
// After the visitor chooses (both keys are required)
window.clarity('consentv2', {
  ad_Storage: 'denied',
  analytics_Storage: 'granted'
});

With Kiescy you can do the same from the consent API: pira.when('analytics', () => window.clarity && window.clarity('consentv2', { ad_Storage: 'denied', analytics_Storage: 'granted' })). Set ad_Storage to granted only if the visitor also allowed advertising.

3. Through Google Consent Mode

If your banner already sends Google Consent Mode v2 (for Google Analytics or Ads), Clarity reads the same analytics_storage and ad_storage signals. Check that the update fires before or soon after Clarity loads. How to implement Consent Mode v2 covers the order.

Each Clarity project is separate. If you run several sites or a staging project, set consent up in each one.

When visitors change their mind

Microsoft says that if a visitor who accepted later rejects, Clarity removes its cookies and starts a new session, so the new session isn't linked to the old one. Your banner needs a way to reopen the choice (a footer link or a small button) and must send the new value to Clarity. Kiescy's banner sends a Consent Mode update when the choice changes.

Cookies Clarity sets

CookiePurposeLifetime
_clckKeeps the Clarity user ID and preferences for your site1 year
_clskConnects page views into one session recording1 day

Clarity can set others too (for example on clarity.ms itself, or MUID when it's linked to Microsoft Advertising). Check your own site with DevTools and list what you find. The free cookie policy generator has a Clarity preset.

Masking and your privacy policy

Session replay can capture what visitors type or see. Clarity masks sensitive content by default; keep strict or balanced masking on, and mask anything else personal, such as order details or account pages. In your privacy policy, name Microsoft Clarity, say it records interactions to improve the site, that it runs only with consent where required, and link Microsoft's privacy statement. Hotjar works the same way; it also needs consent and its own masking settings.

How to check it's working

  1. Open your site in a private window with DevTools → Network open, filtered for clarity.
  2. Before choosing anything, there should be no request to clarity.ms and no _clck cookie (Application → Cookies).
  3. Accept analytics. Clarity's script and the _clck and _clsk cookies should appear.
  4. In Clarity's dashboard, recordings from consenting visitors should show up within a few hours.

The full method for every browser is in how to check which cookies a website sets.

Questions

Is Microsoft Clarity GDPR compliant?

It can be used in a compliant way: run it only after consent for EU and UK visitors, keep masking on, and mention it in your privacy policy. Since October 2025 Clarity also enforces consent for those visitors.

Why did my Clarity recordings drop in November 2025?

From 31 October 2025, Clarity waits for a consent signal from EU, UK and Swiss visitors. Pass consent from your banner and recordings return for visitors who accept.

Is clarity('consent') still supported?

Microsoft lists it as deprecated. Use clarity('consentv2', { ad_Storage, analytics_Storage }) with both values.

Does Clarity read Google Consent Mode?

Yes. Microsoft says Clarity honours the analytics_storage and ad_storage signals, so a banner that sends Consent Mode can control both.

Do I need consent for Clarity in the US?

Not by default, but mention it in your privacy policy, and be careful with session replay in states with wiretapping laws such as California.

Sources

The facts in this guide come from these official sources, last checked on . We review the guide whenever they change.

  1. Microsoft Learn: Clarity Consent API v2
  2. Microsoft Learn: Clarity consent mode
  3. Microsoft Learn: Clarity cookies and Google Consent Mode
  4. ePrivacy Directive 2002/58/EC, Article 5(3) (EUR-Lex)

Does Clarity run before consent?

Our free check opens your site as a first-time visitor and shows whether clarity.ms loads and sets cookies before anyone agrees.

Open the free tool

This guide explains the law in general terms and isn't legal advice. Laws change and how they apply depends on your situation; for high-risk processing, ask a lawyer.

Keep reading

All guides

Get compliant this afternoon, not this quarter.

Set up your policies, banner and request form in one place. Free while Kiescy is in early access.