Cookie Consent

Clarity's tracking code uses a cookie to obtain user session data. A cookie is a small file stored on the browser that tells us how a user accessed your site, the user's location, the user's language preference, and more. As a website publisher, you may be subject to a law that requires you to obtain consent before setting cookies on a user's browser or collecting users' personal information, such as the European Union's General Data Protection Regulation and ePrivacy Directive. Other laws may require you to give your users the ability to opt-out of your use of cookies. This document explains how to customize Clarity's cookie settings.


The following instructions assume that you can supply Clarity with the consent status for each individual visitor to your site. If you don't know whether a visitor has given their consent, or if you can't customize the JavaScript on your site to send the necessary signal to Microsoft, then talk to your website's developer.

By default, Clarity's tracking code is placed in the HTML header of your site. It loads immediately, that is before your user can indicate whether they consent to your use of cookies. Change this setting so that the Clarity tracking code doesn't set cookies right away, and then set a flag that tells us when it's okay to set cookies.

Step 1

Go to Clarity > Settings > Setup, and then turn off the Cookies.

Clarity cookie setting.

After you've made your selection, Clarity will notify you that cookies are off.


Clarity's recordings won't be linked together into multi-page sessions until you inform Clarity of a visitor's consent. Heat maps and data other than session recordings will continue to be available to you.

Step 2

On your website, modify the JavaScript that listens for the event that tells your site whether the visitor has consented to cookies.

  • If the visitor declines cookies, then you don't need to make any more calls because Clarity won't set cookies.
  • If the visitor accepts cookies, then tell Clarity it's ok to track consent for this user and set cookies with following JavaScript call:

Here's an example of the sort of call you could add to the event listener for your cookie compliance script, assuming you fire a consentGranted event when the user accepts cookies:

window.addEventListener("consentGranted", () => window.clarity('consent'));

Once Clarity is informed of the user's consent, we'll provide session data to you that spans multiple pages, so you can take full advantage of our analytical tools.

Steps to confirm Clarity isn't writing cookies

  1. Clear cookies for your website.
  2. Navigate to your website.
  3. Decline to give cookie consent.
  4. Ensure Clarity is executing (check for the /collect calls).
  5. Check your browser cookies and observe that there's no entry for _clck or _clsk

Visit Clarity