Hotjar cookie settings explained
In this article
Hotjar cookie settings determine how user behavior tracking is handled on websites using Hotjar's analytics tools, primarily through consent management and data collection controls. These settings allow website owners to comply with privacy regulations like GDPR and CCPA by giving visitors control over which cookies are active.
Background: What Is Hotjar?
Hotjar is a popular web analytics and user feedback tool that helps website owners understand how visitors interact with their pages. It combines heatmaps, session recordings, conversion funnels, feedback polls, and surveys to provide insights into user behavior. Because Hotjar relies on tracking technologies—including cookies and local storage—to collect this data, it must adhere to global privacy standards that require transparency and user consent.
Hotjar does not host its own cookie banner or consent manager by default. Instead, it integrates with third-party consent solutions or allows developers to configure tracking based on user preferences set through a site’s existing consent mechanism. This means that cookie settings for Hotjar are typically managed externally, not within Hotjar’s dashboard alone.
How Hotjar Uses Cookies
Hotjar deploys several types of cookies when active on a website:
- _hjFirstSeen: Identifies whether it’s a user’s first visit or a return visit (session duration).
- _hjIncludedInSample: Used in sampling logic to determine if a user is included in tracking.
- _hjSession_{SITE_ID}: Tracks session data for heatmaps and recordings.
- _hjRecordingEnabled: Stores user consent status for session recording.
- _hjLocalStorage: Persists user preferences locally, such as opt-out decisions.
These cookies are generally first-party and stored under the website’s domain, not Hotjar’s, which improves compliance and reduces blocking by ad blockers. They are used to recognize users across pages during a session and to respect opt-out choices.
Managing Hotjar Cookie Settings
Configuring Hotjar cookie settings involves both technical setup and policy alignment. Here’s how it typically works:
- Install Hotjar tracking code via the site-wide snippet in the
<head>section of the website. - Integrate with a consent manager (e.g., Cookiebot, OneTrust, Osano, Termly) that supports Hotjar’s consent categories.
- Map consent categories—usually “analytics” or “performance”—to Hotjar’s tracking features.
- Delay Hotjar initialization until user consent is given, using the
window.hjBootstrapmethod or disabling auto-bootstrapping. - Respect opt-out requests by allowing users to disable tracking via a link or preference center.
For example, to prevent Hotjar from loading before consent, developers can use:
window.hj=window.hj||function(){(hj.q=hj.q||[]).push(arguments)};
hj('consent', 'disable');
Later, after user consent:
hj('consent', 'analytics', 'allow');
This ensures compliance by only activating tracking when permitted.
Compliance and Privacy Regulations
Hotjar cookie settings must align with major privacy laws:
- GDPR (EU): Requires explicit, informed consent before non-essential cookies run. Users must be able to withdraw consent easily.
- CCPA/CPRA (California): Allows users to opt out of “sale” or “sharing” of personal information. While Hotjar doesn’t sell data, its session tracking may fall under “sharing” with third-party tools if integrated.
- LGPD (Brazil) and PIPL (China): Have similar consent requirements, especially for behavioral tracking.
A common misconception is that simply adding a cookie banner is enough. However, the underlying code must also block Hotjar from loading until consent is granted. Otherwise, data is collected prematurely, risking non-compliance.
Common Problems and Fixes
Website owners often encounter issues when managing Hotjar cookie settings:
- Tracking despite opt-out: Usually caused by incorrect implementation—e.g., Hotjar loads before consent. Fix: Use
hj('consent', 'disable')before the main script. - Missing consent integration: Some sites use banners that don’t communicate with Hotjar. Fix: Ensure the consent tool supports Hotjar or use custom JavaScript.
- Inconsistent session data: If users clear cookies or block storage, session recordings may be fragmented. This is expected behavior, not a bug.
- Ad blockers preventing Hotjar: Some tools block Hotjar by default. While you can’t bypass these, first-party setup reduces detection.
Alternatives to Hotjar
Several tools offer similar functionality with different privacy approaches:
- Microsoft Clarity: Free, uses first-party cookies and allows easy opt-out; data stored in Azure with GDPR compliance.
- Matomo (formerly Piwik): Open-source, can be self-hosted, giving full control over data and cookies.
- FullStory: Offers robust session replay but requires careful consent management similar to Hotjar.
- Plausible Analytics: Lightweight, privacy-first, uses no cookies by default (only local storage optionally).
Choosing an alternative depends on budget, data ownership needs, and compliance complexity. For strict GDPR environments, self-hosted or cookieless options like Plausible may be preferable.
Frequently Asked Questions
Does Hotjar require cookies to work?
Yes, Hotjar uses cookies to track sessions, recognize returning users, and store consent preferences. However, it supports first-party cookies, which are less likely to be blocked than third-party ones.
How do I stop Hotjar from using cookies without consent?
Use the hj('consent', 'disable') command before loading the tracking code, then re-enable only after user consent is granted via hj('consent', 'allow').
Can users opt out of Hotjar tracking?
Yes. You can provide an opt-out link using https://www.hotjar.com/opt-out, or implement a site-level opt-out that disables Hotjar via JavaScript.
Is Hotjar compliant with GDPR?
Hotjar provides tools to help with GDPR compliance, such as consent APIs and data processing agreements, but compliance ultimately depends on correct implementation by the website owner.
Where are Hotjar cookies stored?
By default, Hotjar uses first-party cookies stored under your website’s domain, not under hotjar.com. This improves reliability and reduces ad-blocker interference.
Do I need a cookie banner for Hotjar?
Yes, if your site serves visitors from regions with privacy laws (like the EU or California). The banner must explain what data is collected and allow users to accept or reject non-essential tracking, including Hotjar.