DEV Community

Cover image for How Microsoft Clarity Consent Mode v2 Actually Wires Into Your CMP (and Why It Matters to the Business)
Mehwish Malik
Mehwish Malik

Posted on

How Microsoft Clarity Consent Mode v2 Actually Wires Into Your CMP (and Why It Matters to the Business)

If you ship marketing analytics for a living, you already know Microsoft Clarity is brilliant for heatmaps and session replay. You also know that running it without consent logic is a problem the privacy team will eventually find.

Here is what Consent Mode v2 actually does at the implementation layer.

Clarity exposes a clarity("consent") call that flips tracking on. Until that call fires, the script holds back recording. Your consent management platform becomes the trigger. When a visitor accepts, your CMP fires the call. When they reject, nothing fires, and Clarity stays silent for that session.

The clean pattern looks like this:

window.clarity = window.clarity || function(){(clarity.q=clarity.q||[]).push(arguments)};
// Inside your CMP's "accept" callback
clarity("consent");
// On reject, do nothing — Clarity respects the silence
Enter fullscreen mode Exit fullscreen mode

No custom proxy. No fragile wrapper script. The CMP is the source of truth, and Clarity follows it.

The business reason this matters is bigger than the code. A clear analysis of the ten benefits marketers gain covers it: heatmaps reflect only opted-in users, session recordings stop violating GDPR and CCPA, and marketing finally trusts the dashboard.

A few engineering wins worth flagging:

  • Granular states. Consent mode v2 supports accepted, rejected, and partial states. You can keep behavioural recording off while still tracking aggregate counts where local law allows.
  • Lightweight. Clarity scripts load asynchronously. Adding the consent check does not measurably hit Core Web Vitals.
  • Audit trail. Because the CMP holds the consent record, your legal team gets a defensible log without you building one.

If your CMP doesn't speak Clarity natively yet, Seers' platform features include a native Clarity handshake out of the box.

Wire it once. Stop questioning your dashboards. Let the privacy team sleep.

webdev #javascript #privacy #analytics #microsoftclarity #gdpr #martech #consentmode #frontend #compliance

Top comments (0)