On this page
What this issue is
Session recording tools (Hotjar, Microsoft Clarity and similar) replay what visitors do on your pages: clicks, scrolls, typing and mouse movement. To do that they load a script and set cookies or local storage in the browser. In many privacy regimes, including the EU and UK, that needs the visitor's consent first.
Why it costs you leads or sales
The cost is mostly risk and trust rather than a broken page. Recording people without a valid consent can expose you to complaints and regulator action, and it can break promises in your own privacy policy. Agencies can put client contracts at risk too.
- Page loadsHeader scripts start
- Recording script loadsHotjar or Clarity starts at once
- Banner shownVisitor has not answered yet
- Visitor rejectsRecording is already running
The recording script starts at page load, before the banner is answered.
How to check if your site has it
Open a private window
Use a fresh incognito or private window so no earlier consent choice is saved. Do not click anything on the banner yet.
Open DevTools Network tab
Press F12, open Network, tick 'Preserve log', then load your page. Filter for 'hotjar', 'clarity' or your tool's domain.
Look for requests before you answer the banner
If requests to static.hotjar.com, script.hotjar.com or www.clarity.ms appear before you click anything, the script is loading before consent.
Check cookies and storage
In the Application tab, look under Cookies and Local Storage for keys starting with _hj or _clck and _clsk.
Repeat after clicking Reject
Clear site data, load the page, click Reject, and check again. Requests that continue after a rejection are the clearest sign of a problem.
The recording should wait for the banner answer, not start before it.
How to fix it
The principle is the same everywhere: remove the always-on script and load it only when the visitor grants the right consent category (usually 'analytics' or 'statistics', or 'marketing' depending on your policy). Pick the route that matches how the tool is installed on your site.
Remove hard-coded copies
Delete the Hotjar or Clarity snippet from your theme or site header so GTM is the only place it loads.
Use a consent-aware trigger
In the recording tag, open Advanced Settings > Consent Settings and require the consent type you use (for example analytics_storage). Better still, fire the tag on a custom event your consent tool pushes after acceptance.
Remove 'All Pages' if it bypasses consent
If the tag fires on Initialization or All Pages without a consent check, change it so it cannot run until consent is granted.
Test in Preview mode
Use GTM Preview, deny consent and confirm the tag shows as 'Not fired'. Then accept and confirm it fires once.
Find how the script is added
Check your theme header, a plugin such as a Hotjar or header-scripts plugin, or Google Tag Manager. Remove duplicates.
Use your consent plugin's blocking
In your consent plugin (the exact menu depends on the plugin), add the script to the blocked-until-consent list under the analytics or statistics category, or wrap it as a consent-managed script.
Clear caches
Purge page cache and any CDN cache so old pages without the blocking do not keep serving the script.
Check Customer Privacy settings
In Settings > Customer privacy, set up the cookie banner and regions where consent is required.
Install the tool via a consent-aware route
Load recording through a Shopify app that respects the Customer Privacy API, or through a custom pixel under Settings > Customer events, where you can set the permission it requires.
Remove theme.liquid copies
Search theme.liquid for 'hotjar' or 'clarity' and remove any hard-coded snippet.
Remove the snippet from Custom Code
Open Site settings > Custom code and delete the recording script from the head and footer sections.
Load it through your consent tool
Add the script in your consent tool's configuration or via Google Tag Manager with a consent condition, then publish.
Use Wix's consent banner
In Settings > Cookie Banner, enable the banner. Add custom code via Settings > Custom code.
Set the category
When adding the recording script, set its cookie category to Analytics (or the closest fit) so it loads only after the visitor accepts it.
Move the script out of Code Injection
Scripts in Settings > Advanced > Code Injection run for everyone. Remove the recording snippet from there.
Use the built-in cookie banner or a consent tool
Add the script through Google Tag Manager with a consent condition, or through a consent tool that can hold scripts until accepted.
Find tracking code
Check the funnel or website Settings > Tracking Code (head and footer) and remove the recording snippet.
Load conditionally
Add the script via a consent tool or Google Tag Manager so it only runs after consent. GoHighLevel's own code boxes run on every load.
Do not include the script in the HTML
Remove the static script tag and inject it from JavaScript only after consent is granted. See the snippet below.
Listen to your consent tool
Use the callback or event your consent tool offers, and also check stored consent on page load for returning visitors.
function loadClarity(projectId) {
if (window.__clarityLoaded) return;
window.__clarityLoaded = true;
(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',projectId);
}
// Call this from your consent tool's 'analytics accepted' callback
// and on page load if stored consent already allows analytics.
// loadClarity('YOUR_PROJECT_ID');Before
- Script in the header on every page
- Requests sent before the banner is answered
- Recording continues after Reject
After
- Script loads only after analytics consent
- No recording requests while consent is denied
- Returning visitors who accepted are recorded as expected
How to confirm it's fixed
- In a fresh private window, no requests to your recording tool appear before you answer the banner
- After clicking Reject, no recording requests or _hj / _clck cookies appear, even after navigating to a second page
- After clicking Accept, the script loads once and recording starts
- A returning visitor who previously rejected is still not recorded
- A returning visitor who previously accepted is recorded without seeing the banner again
- The recording tool's dashboard shows no new sessions from your rejected test
How to prevent it happening again
Consent gating tends to break when someone adds a new tag or pastes a snippet in a hurry. A few habits help.
- Keep one place where tracking scripts are added (ideally Google Tag Manager) and forbid hard-coded copies
- Require a consent check on every new analytics or recording tag before publishing
- Re-run the denied-consent test after theme changes, plugin updates, consent tool changes and site migrations
- Document which consent category each tool belongs to
- Review recording tools when your cookie banner provider or policy changes
How FunnelGuard handles this
FunnelGuard detects this issue only partly. When it runs your journey with consent denied, it records the tracking hits sent during the run. What it checks is that variant: the denied run shows hits only if those hits can be parsed, meaning FunnelGuard can recognise and read them as belonging to a known tag or platform.
Consent: blocked / denied
- GA4no hit
- Google Adsno hit
- Meta Pixelno hit
The recording script runs even when the visitor rejects cookies, so sessions are captured without consent.
Toggle to see how consent gating changes what the recording tool receives.
Frequently asked questions
Questions people ask
Why is Hotjar loading before the cookie banner?
Usually the Hotjar snippet is hard-coded in your theme header or fires on an All Pages trigger in Google Tag Manager, so it runs at page load. Remove the hard-coded copy and load Hotjar only after the visitor grants the analytics category in your consent tool.
How do I stop Microsoft Clarity recording until consent is given?
Load the Clarity script only after consent, for example from a Google Tag Manager tag with a consent condition or from your consent tool's callback. Check Clarity's current documentation for its consent signal option, then test with consent denied to confirm nothing is sent.
Does session recording need cookie consent?
In many places, including the EU and UK, recording tools that set cookies or storage and track individuals usually need consent. Rules vary by country and tool, so confirm with a privacy adviser. Technically, make sure the script follows whatever choice the visitor made.
How can I check if a script loads before consent?
Open a private window, open DevTools Network with Preserve log on, and load your page without touching the banner. Filter for your tool's domain, such as hotjar or clarity.ms. Any requests before you answer mean it loads before consent.
Does Google Tag Manager consent mode block session recording tools?
Not automatically. Consent mode signals only affect tags that read them, and a third-party recording tag may ignore them. Set Consent Settings on the tag, or fire it from a trigger that waits for a consent event, then test in Preview mode.
Will gating session recording behind consent reduce my data?
Yes, you will only record visitors who accept, so the sample is smaller. That is the correct result of respecting consent. Use recordings to spot patterns rather than to count total traffic.
Can FunnelGuard tell me if session recording loads before consent?
Partly. FunnelGuard runs a variant with consent denied and shows hits only when it can parse them. It does not reliably catch unparsed recording requests or inspect cookies, so verify the rest manually in your browser.
Related issues
- TRK-238Hotjar script missing or wrong site IDFix guide
- TRK-239Microsoft Clarity missing or wrong project IDFix guide
- TRK-240Session recording capturing form fields (PII in recordings)Fix guide
- TRK-242Heatmap tool slowing page (heavy script)Fix guide
- TRK-243Mixpanel / Amplitude / Segment events missingFix guide
- TRK-244Segment write key wrong or destinations offFix guide