Secure Privacy

How to Set Up Microsoft Clarity Consent Mode with Secure Privacy (GDPR Guide)

Learn how to configure Microsoft Clarity Consent Mode to comply with GDPR and manage cookie consent seamlessly through Secure Privacy — no custom coding required.

SPT
Secure Privacy Team
3 min read ()

Who is this for? This guide is intended for website owners, developers, and digital marketers who use Microsoft Clarity for behavioral analytics and need to ensure their implementation complies with GDPR and other data privacy regulations through Secure Privacy.

Microsoft Clarity enables businesses to prioritize user privacy while collecting valuable behavioral analytics for website optimization. Its built-in Consent Mode is designed to comply with data protection regulations such as GDPR, ensuring responsible, regulation-ready data handling at all times.

  • Tailoring data collection: Adjust how Clarity tracks user interactions based on each visitor's consent preferences.
  • Controlling cookie access: Manage cookie usage to ensure compliance with user permissions using straightforward consent controls.
  • Collecting limited anonymized data: When full consent is not provided, Clarity can still gather anonymized, cookieless data to provide behavioral insights without compromising visitor privacy.

Consent Mode in Microsoft Clarity is managed through direct JavaScript commands that enable or disable tracking and cookie usage. The two primary commands are:

Command Description
window.clarity("consent") Enables Clarity to read and write first- and third-party cookies for analytics purposes. This is the default behavior if no consent setting is specified.
window.clarity("stop") Disables Clarity from reading or writing first-party cookies. Third-party cookies are not written and are read-only for fraud detection purposes only — not analytics.

Clarity uses a JavaScript function called clarity on the window object. Unlike Microsoft UET consent mode, it does not rely on a property like ad_storage — instead, it uses the consent and stop keywords to control tracking behavior directly.

A default consent state should be set on each page load before capturing user consent:

  • GDPR-regulated regions (e.g., EU/EEA): Use stop as the default to block cookies until consent is granted.
  • Non-GDPR regions (e.g., most U.S. states): Use consent as the default to allow analytics tracking.

Clarity manages cookies by enabling or restricting them based on the active consent state. When the Clarity framework is enabled but consent is denied, Microsoft cookies are not blocked outright — they are restricted. The affected cookies include:

  • _clck
  • _clsk
  • CLID
  • MR

To start using Microsoft Clarity with Secure Privacy's cookie consent management, follow these steps:

  1. Navigate to Domain Settings:

    Log in to your Secure Privacy dashboard and go to Domain Settings.

  2. Access the Advanced Tab:

    Within Domain Settings, click on the Advanced tab.

  3. Enable the Microsoft Clarity Toggle:

    Inside the Advanced tab, locate the toggle for Microsoft Clarity Consent Mode and enable it.

Secure Privacy dashboard Advanced tab showing the Microsoft Clarity Consent Mode toggle

After enabling the toggle, verify your setup using browser developer tools or Secure Privacy's built-in debug mode. Confirm that:

  • The Clarity script loads only when appropriate consent has been granted.
  • Consent-based commands (stop or consent) are correctly executed in response to user choices.

Secure Privacy automatically handles consent storage and synchronization. Once a user grants or denies consent, Microsoft Clarity will behave accordingly — with no additional manual coding required on your part.


Does Microsoft Clarity collect any data when consent is denied?
When window.clarity("stop") is active, Clarity does not read or write first-party analytics cookies. However, it may still collect limited, anonymized and cookieless behavioral data to support basic insights without identifying individual users.
Is Microsoft Clarity Consent Mode compatible with GDPR?
Yes. Clarity's Consent Mode is designed with GDPR compliance in mind. By defaulting to stop for EU/EEA visitors and only activating full tracking upon explicit user consent, it aligns with GDPR's requirements for lawful data processing.
Do I need to write custom code to integrate Clarity with Secure Privacy?
No. Secure Privacy's native Microsoft Clarity integration handles all consent signaling automatically. Simply enable the toggle in your Domain Settings — no additional JavaScript coding is needed.

Need more help?

Our privacy experts are here to guide you through complex regulations and find the right solution.

Contact Support

Related Articles

View all