Overview
Hotjar may belong to analytics or preferences depending on how you use heatmaps and session recordings. CookiePilot helps hold _hj cookies and the Hotjar script until the right consent is granted.
analytics or preferences.
_hjSession, _hjSessionUser.
Session replay needs careful privacy configuration.
Consent behaviour
No _hj before consent.
After Reject, no static.hotjar.com.
Field masking works where needed.
Setup steps
Assign Hotjar to analytics or preferences according to your policy.
Do not load the script before that category is granted.
Test forms and pages with sensitive data.
Example snippet
Example snippet
<!-- Hotjar after analytics or preferences consent, depending on your banner category. -->
<script>
window.addEventListener('cookiepilot:consent', function (event) {
var consent = event.detail || {};
if (!(consent.analytics || consent.preferences) || window.__hotjarLoaded) return;
window.__hotjarLoaded = true;
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid: HOTJAR_SITE_ID, hjsv: 6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
});
</script>Test checklist
No _hj before consent.
After Reject, no static.hotjar.com.
Field masking works where needed.
Setup steps
- 1Assign Hotjar to analytics or preferences according to your policy.
- 2Do not load the script before that category is granted.
- 3Test forms and pages with sensitive data.
Test checklist
- No _hj before consent.
- After Reject, no static.hotjar.com.
- Field masking works where needed.
FAQ
Is this legal advice?
No. It is an implementation guide. For unusual data flows, confirm the setup with your legal or privacy team.
Does CookiePilot block every script automatically?
CookiePilot supports autoblocking and Consent Mode. Trackers hardcoded before the CMP still need to be moved behind the stub or into GTM Consent Initialization.
Related integrations
See the setups that most often appear together with this integration.
Ready to configure it?
Start CookiePilot, choose the right integration and verify that tags wait for user consent before they run.