PrivacyQuick

Google Consent Mode & analytics

Hotjar, Microsoft Clarity and session replay consent

Session replay and heatmap tools record how visitors use your pages, so in the EU, EEA, UK and Switzerland they should only run after the visitor opts in. Microsoft Clarity now expects a consent signal for visitors from those regions, and every replay tool needs careful masking.

  • Plain English
  • Written for website owners
  • Free to read

Session replay tools such as Hotjar and Microsoft Clarity need opt-in consent before they run for visitors in the EU, EEA, UK and Switzerland. They store identifiers on the visitor's device and record detailed behavior, and neither is strictly necessary to deliver your site. Since October 31, 2025, Microsoft has also required Clarity users to send a consent signal for visits from those regions. Consent is only half the job, though. Because replays can capture anything typed or shown on screen, you also need to configure masking, exclude sensitive pages, and keep recordings for as short a time as possible.

What session replay actually records

A session replay script doesn't record video. It records the page's DOM (the structure and text of the page), plus every change to it, mouse movement, click, scroll and window resize. The vendor rebuilds this into something that looks like a screen recording. Heatmaps aggregate the same click and scroll data across many visitors.

That approach makes these tools powerful for finding broken forms and confusing layouts. It also creates real privacy risk:

  • Typed text. Unless input is masked, anything entered in a field can be captured, including fields that are never submitted.
  • Displayed personal data. Account pages, order confirmations and dashboards show names, addresses and order details as page text.
  • Sensitive inferences. On a health, finance or dating site, simply visiting a page can reveal something sensitive.
  • Persistent identifiers. Cookies or storage items link sessions across visits, so one person's behavior builds up over time.

ePrivacy Directive Art. 5(3), and national rules such as the UK's PECR regulation 6, require consent before storing or reading information on a device unless it's strictly necessary for a service the user asked for. Session replay helps you improve your site. It's not something the visitor requested, so the exemption doesn't apply.

Some countries exempt simple audience measurement. France's CNIL is the best-known example. But the CNIL limits that exemption to audience measurement and A/B testing, and features like session recordings and heatmaps fall outside it. A replay tool needs consent there even when your basic analytics doesn't. (If you're weighing up analytics that avoids the banner question altogether, see cookieless analytics.)

The GDPR applies on top. Recordings are personal data, so you need a legal basis (consent, in this context), a data processing agreement with the vendor under Art. 28, and a clear entry in your privacy policy. Art. 25 (data protection by design and by default) is the hook for the masking and minimization steps below.

Microsoft's documentation says that from October 31, 2025, Clarity enforces consent signal requirements for page visits from the EEA, the UK and Switzerland. Without a valid signal, those visits don't get Clarity's full functionality.

Here's how Clarity behaves, according to Microsoft's docs as of late 2026:

  • Consent granted: Clarity sets its cookies and links sessions across pages and visits.
  • Consent denied or not given: Clarity runs in a limited no-consent mode. It sets no cookies and assigns a new ID for each page view, so sessions can't be stitched together.
  • Consent withdrawn: Clarity deletes its existing cookies, ends the session and continues in no-consent mode.

Microsoft offers several ways to send the signal. If your consent tool already sends Google Consent Mode signals, Microsoft documents a Consent Mode integration, which is the simplest route for many sites. Otherwise, use the ConsentV2 API, which Microsoft recommends over the older clarity('consent') call:

window.clarity('consentv2', {
  ad_Storage: 'granted',       // or 'denied'
  analytics_Storage: 'granted' // or 'denied'
});

Note the unusual capitalization of ad_Storage and analytics_Storage, which is how Microsoft's reference writes them. To clear Clarity's cookies and stop tracking when a visitor withdraws consent, Microsoft documents window.clarity('consent', false).

No-consent mode is Microsoft's product behavior, not a legal exemption. Clarity's script still loads and still sends interaction data to Microsoft before consent. For EU and UK visitors, the safer approach is not to load Clarity at all until the visitor opts in, then send the consent signal straight away.

Hotjar and other replay tools

Hotjar sets first-party cookies such as _hjSessionUser_{site ID} and _hjSession_{site ID} to recognize users and sessions, so the same Art. 5(3) analysis applies. Most other replay tools (FullStory, Smartlook, Mouseflow, LogRocket and others) work in a similar way. Their documentation and settings change often, so check each vendor's current consent and privacy guidance rather than relying on older blog posts.

The vendor-neutral approach works with every tool: don't load the script until the visitor accepts the right category. With PrivacyQuick, you tag the script with the analytics category. For Clarity, you can also send the ConsentV2 signal inside the same blocked script, so it runs only after consent:

<script type="text/plain" data-category="analytics">
  (function(c,l,a,r,i,t,y){
    c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
    t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
    y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
  })(window, document, "clarity", "script", "YOUR_PROJECT_ID");

  window.clarity('consentv2', {
    ad_Storage: PrivacyQuick.has('marketing') ? 'granted' : 'denied',
    analytics_Storage: 'granted'
  });
</script>

If the visitor later withdraws analytics consent, PrivacyQuick reloads the page so the script no longer runs. For other ways to gate scripts, see how to block cookies and scripts until consent.

Masking: decide what never gets recorded

Consent doesn't make it acceptable to record passwords, card numbers or health details. Data minimization (GDPR Art. 5(1)(c)) applies even when the visitor agreed. Configure masking before you go live:

ControlMicrosoft ClarityHotjar
Global masking levelProject setting with Strict, Balanced and Relaxed modes. Strict masks all text.Site settings to suppress text and keystrokes; check the current options in your account
Mask a specific elementdata-clarity-mask="true"data-hj-suppress
Unmask a safe elementdata-clarity-unmask="true"data-hj-allow

Practical rules that work with any tool:

  • Start strict. Mask all input fields and all text by default, then unmask headings, navigation and button labels you actually need.
  • Mark sensitive containers. Add the mask attribute to blocks that show account details, addresses, order summaries or messages:
    <section class="account-details" data-clarity-mask="true" data-hj-suppress>
      …
    </section>
  • Exclude whole pages. Don't load the replay script on checkout, payment, login, password reset, account, or any page about health or other special category data (GDPR Art. 9).
  • Keep personal data out of URLs. Replay tools record page URLs. Email addresses or tokens in query strings end up in recordings.
  • Check a sample of recordings after launch and after every major release. New components often ship without mask attributes.

Retention, access and vendor terms

  • Retention. Set the shortest retention that still lets you act on findings. Record the period in your privacy policy.
  • Access. Limit who in your team, and among agencies, can watch recordings.
  • Processor terms. Sign the vendor's data processing agreement, and check where data is stored and what transfer mechanism applies if it leaves the EEA or UK.
  • Vendor's own use. Read whether the vendor uses your data for its own purposes, such as product improvement or advertising. If it does, say so in your disclosures, and consider whether the tool belongs under marketing too.

US sites: wiretapping risk

The US has no general opt-in rule for cookies, but session replay has attracted a wave of class actions under state wiretapping laws, especially the California Invasion of Privacy Act. The argument is that the replay vendor "intercepts" communications between the visitor and your site. Outcomes vary by court and by facts. Clear disclosure in your privacy policy, a banner notice, masking, and consent before recording on sensitive sites all reduce exposure. See session replay, chat and pixel wiretapping lawsuits for the background.

Mistakes that undo a careful setup

  • Installing the tool twice. A plugin or platform integration loads Clarity or Hotjar directly while your consent-gated copy waits. Search your theme, tag manager and plugin settings for the project ID.
  • Relying on the vendor's default masking. Defaults differ between tools and change over time. Check what's actually visible in a few real recordings.
  • Recording staff and admin pages. Back-office screens often show customer data in bulk. Keep the script off them.
  • Sending identifiers on purpose. Features that tag sessions with a user ID or email make recordings directly identifiable. Use them only if you really need them, and say so in your privacy policy.
  • Forgetting the banner text. If the analytics description only mentions "statistics," visitors won't expect their clicks and scrolls to be replayed. Name session recording explicitly.

Product analytics tools have their own consent settings: see Segment, Mixpanel, Amplitude and PostHog.

If your tool is Hotjar in particular, our Hotjar and cookie consent guide walks through finding every load, gating the script on the analytics choice and testing a rejected visit.

Setup checklist

  1. Put your replay tool in the analytics category in your banner, and describe it plainly, for example "records how you use our pages, such as clicks and scrolls, to help us fix problems."
  2. Block the script until consent for EU, EEA, UK and Swiss visitors.
  3. For Clarity, send a ConsentV2 or Consent Mode signal as soon as consent is given.
  4. Set the strictest masking level you can live with, and mask sensitive containers explicitly.
  5. Exclude checkout, account and other sensitive pages from recording.
  6. Set retention, restrict access and sign the vendor's DPA.
  7. Name the tool, its purpose and its retention in your cookie policy and privacy policy.
  8. Run a cookie scan to confirm no replay cookies are set before consent.

Frequently asked questions

Does Microsoft Clarity work without consent?

According to Microsoft's documentation, when consent is denied or missing, Clarity runs in a limited no-consent mode: it sets no cookies and assigns an ID per page view. For visitors from the EEA, UK and Switzerland, Microsoft says a valid consent signal is needed for full functionality.

Is session replay covered by the CNIL analytics exemption?

No. The CNIL exemption is limited to audience measurement, and session recordings and heatmaps go beyond it, so they need consent for French visitors.

Should session replay be in the analytics or marketing category?

Most sites put it under analytics, since it is used to understand and improve the site. If the vendor uses the data for advertising, or you connect replays to ad platforms, it belongs under marketing as well.

Do I need consent for session replay in the US?

There is no general opt-in cookie law in the US, but session replay has been the subject of many wiretapping lawsuits under laws like California's CIPA. Clear disclosure, and for some sites consent before recording, reduces that risk.

Check your own website in 30 seconds

Our free scanner lists every cookie and tracker your site sets, sorted into categories, before you add a banner.

Run a free cookie scan Start free

This guide is general information, not legal advice. Laws and regulator guidance change; check the current rules for your situation or ask a lawyer.