Home / Blog

How-to

Microsoft Clarity and Cookie Consent on WordPress: Setup Guide

12 min readBy the ClearCrumb team

Clarity cookie consent means two things on a WordPress site: Microsoft Clarity must not record a visitor or set its cookies before they agree, and Clarity must be told what they chose. Since 31 October 2025 Microsoft enforces consent signals for visitors from the European Economic Area, the United Kingdom and Switzerland, so a missing signal now costs you data as well as risk. This guide is for site owners, shop owners and agencies who use Clarity heatmaps and session recordings and want a Clarity cookie consent setup they can check in about five minutes.

What is Clarity cookie consent, and why did it change?

Microsoft Clarity is a free behaviour analytics tool. It records sessions, draws heatmaps and flags “rage clicks” so you can see where visitors get stuck. To link page views into one session and one returning user, it stores first-party cookies such as _clck and _clsk in the visitor’s browser, and it can also use Microsoft cookies such as MUID.

Under Article 5(3) of the ePrivacy Directive, and in the UK under the Privacy and Electronic Communications Regulations (PECR), storing or reading those cookies needs consent unless it is strictly necessary. Analytics is not strictly necessary, so Clarity belongs in the statistics category of your banner, behind a clear yes.

What changed is Microsoft’s side of Clarity cookie consent. Microsoft’s documentation says that starting 31 October 2025, Clarity enforces consent signal requirements for visits from the EEA, the UK and Switzerland. For those visitors, Clarity’s own Consent Mode is on by default and the consent state is “denied” until your site updates it. Microsoft also says Clarity treats a consent as valid for up to nine months.

In plain terms: if your site never sends a Clarity cookie consent signal, European visitors are recorded without cookies, so sessions break apart and returning users look new. If your site loads Clarity before a choice and sets cookies anyway, you have the older problem: tracking before consent.

Fact Detail (checked October 2026)
Enforcement date 31 October 2025
Regions EEA, United Kingdom, Switzerland
Default for those regions Consent Mode on, state “denied” until updated
Signal to send clarity('consentv2', { ad_Storage, analytics_Storage }) or Google Consent Mode
Older API clarity('consent'), planned for deprecation
Consent validity at Clarity Up to 9 months unless updated

What does each Clarity cookie consent state do?

Clarity reads two consent types, named after Google’s: analytics_Storage and ad_Storage. Each is “granted” or “denied”, and each changes a different part of Clarity’s behaviour. Microsoft’s Consent API v2 reference gives the exact call and the effect of each value.

Consent type Granted Denied
analytics_Storage Cookies are set, sessions and returning users are tracked, all features work The tag still loads, but only cookieless data is collected, with a new ID for every page view
ad_Storage Clarity shares data with Microsoft Advertising No data is shared with Microsoft Advertising

Two details matter for your Clarity cookie consent plan. First, “denied” does not mean “off”: Clarity still runs and still collects page-level data, only without cookies. Second, when a visitor rejects after accepting, Microsoft says Clarity deletes its existing cookies for the site, ends the session and continues in no-consent mode on future visits until consent is given again.

Features that depend on joining page views, such as full session recordings across pages and funnels, are limited without consent. That is the price of the cookieless mode, and it is why many sites decide that Clarity should simply wait.

Should Clarity wait for consent or run cookieless?

There are two ways to handle Clarity cookie consent. You can hold the whole Clarity tag until the visitor allows statistics, or you can let it load straight away in denied mode and update it after the choice. Microsoft’s documentation describes the second approach. Most consent plugins, including ClearCrumb, use the first one by default.

Clarity cookie consent options: wait for consent compared with cookieless denied mode
Two Clarity cookie consent approaches before a visitor chooses.

Holding Clarity back is the cautious choice. Nothing reaches clarity.ms before a yes, so there is nothing to explain later. The cookieless mode collects more data from people who never click the banner, but it still sends information about the visit to Microsoft before any choice. Whether that is acceptable without consent is a question for your own lawyer and your regulator’s guidance; regulators differ on cookieless analytics, and the ICO in the UK reads PECR broadly.

Approach Before a choice Good for Trade-off
Wait for consent No request to Clarity at all EU and UK sites that want the lowest risk No data from visitors who ignore or reject the banner
Cookieless denied mode Clarity loads, no cookies, ID per page view Sites whose lawyer has cleared cookieless analytics Data still leaves the browser before consent

For US visitors the starting point is different. Most US state privacy laws, such as the CCPA/CPRA in California, work on an opt-out model, so analytics may run until a visitor objects. A Clarity cookie consent setup that holds the tag in Europe and lets it run in the US covers both models, provided the US side still respects an opt-out.

How do you set up Clarity cookie consent with ClearCrumb?

ClearCrumb is a free cookie consent plugin for WordPress by Dotance. Microsoft Clarity is in its service library as a statistics service, recognised by its tag address (clarity.ms/tag) and its cookies. Once Clarity is in your list, ClearCrumb rewrites the Clarity snippet on the server so it does not run, and its guard script blocks a Clarity tag that another script tries to add later. This works the same way whether you pasted the snippet into your theme, use Microsoft’s own Clarity plugin, or load it through Google Tag Manager.

Here is the Clarity cookie consent setup, step by step:

  1. Install ClearCrumb from WordPress.org and run the setup wizard. Keep your normal Clarity installation as it is; you do not need to remove or edit the snippet.
  2. Find Clarity in your services. Open ClearCrumb → Services & cookies. If Clarity is not listed yet, click Scan site, or use Add service and search the library for “Microsoft Clarity”.
  3. Check the switch. In the Wait for consent column, Clarity should be on and show Blocked, in the Statistics category. If it says Loads without consent, switch it back on.
  4. Keep the consent signals on. In the Consent signals card on the same page, leave Google Consent Mode v2 on Basic (recommended) and click Save signals if you changed anything. Microsoft says Clarity reads Google Consent Mode signals, so this gives Clarity a second way to learn the choice.
  5. Clear your page cache and open the site in a private window. You should see the banner, and no request to clarity.ms until you allow statistics.

The script blocking documentation explains the rewrite in more detail, including how blocked tags are released in their original page order. Blocking happens in the same way for every visitor, so cached pages stay valid.

On the Clarity side, Microsoft recommends one more step: in your Clarity project, open Settings, then Setup, and switch the cookies setting off. Clarity then waits for a valid consent signal before it sets cookies for every visitor, not only those from the EEA, the UK and Switzerland. With ClearCrumb holding the tag, this is a second safety net. It matters most where Clarity runs without a click, such as for US visitors under ClearCrumb’s default opt-out rule: Clarity then sets cookies only after a granted signal.

An honest note: ClearCrumb does not put Clarity into the cookieless denied mode before a choice. The Advanced Consent Mode setting lets Google tags and Microsoft Advertising (UET) load in denied mode, but Clarity keeps waiting. If you want Clarity to run cookieless before consent, a consent platform built around that model, or a custom setup with your developer, is the better pick.

How does the choice reach Clarity?

When a visitor chooses, ClearCrumb sends the result to every tool that listens. For Clarity cookie consent it does two things, both checked in the plugin’s source (version 1.0.3):

  • The Clarity Consent API. On every choice, and on every page for a returning visitor, ClearCrumb calls clarity('consentv2', …). If Clarity has not loaded yet, the call waits in Clarity’s own queue and is read as soon as Clarity starts. Statistics maps to analytics_Storage and marketing maps to ad_Storage, each “granted” or “denied”.
  • Google Consent Mode v2. With Consent Mode on, ClearCrumb declares a consent default before any tag runs, and an update after each choice. For a returning visitor, the default already carries their saved choice.
How a Clarity cookie consent choice reaches Microsoft Clarity through ClearCrumb
How a Clarity cookie consent choice travels from the banner to Clarity.

Timing is handled for you. Because ClearCrumb holds the Clarity tag, Clarity is usually not on the page yet at the moment of a first “Accept”. Since version 1.0.3, ClearCrumb releases the held tags first and then sends consentv2 through Clarity’s queue, so Clarity reads the choice the moment it starts. A returning visitor’s saved choice is sent again on every page. Earlier versions sent the call only when Clarity was already running; if you are on 1.0.2 or older, update the plugin. Confirm it on your own site with the console check below.

When a visitor takes a yes back, ClearCrumb reloads the page so that Clarity is blocked again; a script that has already run cannot be stopped any other way. ClearCrumb does not delete Clarity’s own cookies at that point. They stay in the browser until they expire or the visitor clears them, but Clarity no longer runs to read them. Every choice is also pushed to the dataLayer as a clearcrumb_consent event, which is useful if Clarity runs inside Google Tag Manager. The Consent Mode documentation lists every signal ClearCrumb sends.

How do you check that Clarity cookie consent works?

Test Clarity cookie consent at three moments: before a choice, after “Accept all” and after “Reject all”. You need a private browser window, the developer tools (F12) and about five minutes.

Clarity cookie consent check: before consent, after accept, after reject, then the Leak Test
Three moments to test Clarity cookie consent, then a site-wide Leak Test.
  1. Before a choice. Open a private window, open the Network tab, type clarity in the filter box and load your page. Do not touch the banner. With the tag held, the list stays empty, and the Application tab shows no _clck or _clsk cookie.
  2. After “Accept all”. Click Accept all. Requests to clarity.ms should appear, including /collect calls. Then paste Microsoft’s check into the Console: clarity('metadata', (d, upgrade, consent) => { console.log('consentStatus:', consent); }, false, true, true);. It should report analytics_storage: "GRANTED". Load a second page and run it again.
  3. After “Reject all”. Clear the site’s cookies, reload, and click Reject all. No request to clarity.ms should follow.
  4. Across the site. In WordPress, open ClearCrumb → Scanner and click Run Leak Test. It loads your pages like a brand-new EU visitor who has not clicked anything yet, then after “Accept all”, and lists every tracker that still fires before consent.

Our cookie banner leak test guide explains the Network-tab method in more detail. For a quick outside view of any public page, the free Cookie Banner Checker reads the page as a first-time visitor and shows whether Clarity’s snippet is held back. It reads the page source only, so a Clarity tag added later inside a tag manager needs the browser test.

Do one more Clarity cookie consent check in the Clarity dashboard a few days later. If recordings from European visitors look like single page views with no returning users, Clarity is not getting a granted signal, and the one-line fix above is worth adding.

Common Clarity cookie consent mistakes

Most broken Clarity cookie consent setups come from a short list of causes. Each one has a simple fix.

Mistake What happens Fix
Clarity loads before the banner Recording starts before any choice Hold Clarity until statistics consent, then clear the cache
No consent signal at all European visits stay cookieless, sessions break apart Send consentv2 or Google Consent Mode after the choice
Clarity in the necessary category It runs for everyone, including people who rejected Classify it as statistics
Two copies of the snippet One copy, often in GTM, escapes the banner Keep one installation and run the Leak Test
Consent Mode switched off Clarity cannot learn the choice when it loads after it Keep Consent Mode on Basic, or add the one-line call
Clarity cookies left on Clarity may set cookies wherever no “denied” signal arrives Switch cookies off in Clarity’s Setup settings

A last point on wording. Your cookie policy should name Clarity, say that Microsoft is the provider, list its cookies and explain how to change a choice. A visible “Cookie settings” link is part of a sound Clarity cookie consent setup, because withdrawing must be as easy as giving consent. ClearCrumb shows a floating button for this by default.

Frequently asked questions

Does Microsoft Clarity need cookie consent?

In the EU and the UK, yes, in most cases: Clarity’s cookies serve analytics, which is not strictly necessary, so the ePrivacy rules require consent first. Since 31 October 2025 Microsoft also enforces consent signals for EEA, UK and Swiss visitors. In the US, most state laws use an opt-out model instead.

What is the Clarity cookie consent API?

It is the call clarity('consentv2', { ad_Storage, analytics_Storage }), with each value set to “granted” or “denied”. It replaces the older clarity('consent') call, which Microsoft plans to deprecate. Clarity also accepts Google Consent Mode signals.

Does Clarity still record visitors who reject cookies?

If the Clarity tag is on the page, yes, in a cookieless mode with a new ID for each page view. If your consent plugin holds the tag until consent, as ClearCrumb does by default, Clarity does not load for those visitors at all.

Do I need to edit my Clarity snippet for Clarity cookie consent?

Usually not. ClearCrumb finds and holds the snippet wherever it comes from. Since ClearCrumb 1.0.3 the consentv2 call is sent for you, also on the first Accept. Check the console status after accepting; if it still shows “DENIED”, make sure the plugin is up to date.

Does ClearCrumb support Clarity in Google Tag Manager?

Yes. With Consent Mode on Basic, Google Tag Manager waits for consent, and a Clarity tag it adds later is blocked until statistics are allowed. Every choice is also pushed to the dataLayer as the clearcrumb_consent event for your own triggers. There is no ClearCrumb tag template for Google Tag Manager.

Summary

A sound Clarity cookie consent setup holds Microsoft Clarity until a visitor allows statistics, then tells Clarity what they chose through the consentv2 call or Google Consent Mode. ClearCrumb does the first part with no setup and sends both signals; confirm it with Microsoft’s console check and the Leak Test. For the related Google setup, read our guide to Consent Mode v2 on WordPress. The UK regulator’s view is in the ICO’s guidance on storage and access technologies. Facts checked October 2026.

This article explains how Clarity and cookie consent work technically. It is not legal advice; ask a lawyer about your own situation.

Free on WordPress.org.

Consent Mode v2, Leak Test, GPC and a consent log, all in the free plugin.