GDPRChecker

Home / Knowledge Base / Hotjar Next.js Cookie Consent: A Practical Compliance Guide for Website Owners

Website Compliance

Hotjar Next.js Cookie Consent: A Practical Compliance Guide for Website Owners

A practical guide for Next.js website owners on implementing Hotjar cookie consent for GDPR compliance. Covers requirements, step-by-step implementation, common mistakes, and validation using GDPRChecker's scanner.

Run a free GDPR compliance scanPreview the findings before choosing a CMP.

Author

GDPRChecker Editorial Team

Reviewed by

Privacy & Compliance Research Team

Last updated

July 2026

Reading time

10 min read

Educational guidance for compliance readiness — not legal advice. Requirements vary by jurisdiction and your specific processing activities.

Introduction

Updated for 2026 compliance practices.

Hotjar Next.js cookie consent is a practical compliance topic for website owners validating consent, tags, and disclosures. If you run a Next.js site and use Hotjar for analytics, heatmaps, or session recordings, you need to ensure that your cookie consent setup meets GDPR requirements. This guide walks you through what Hotjar Next.js cookie consent means, how to implement it step by step, common pitfalls to avoid, and how to verify your setup using GDPRChecker’s scanner. We focus on technical implementation guidance, not legal advice, so you can close consent gaps and keep your site compliant.

Requirements and Compliance Expectations

When implementing Hotjar Next.js cookie consent, you must meet several key requirements under the GDPR and ePrivacy Directive. These expectations are based on guidance from authorities like the European Data Protection Board (EDPB) and GDPR.eu, as well as technical standards such as Google Consent Mode. While this guide provides technical implementation guidance, not legal advice, the following points are widely accepted as necessary for compliance:

  • Prior consent: Hotjar cookies and tracking must not be set until the user has taken a clear affirmative action, such as clicking “Accept” on a cookie banner. Implied consent or continued browsing is not sufficient.
  • Granular choice: Users should be able to consent to different categories of cookies separately. Hotjar typically falls under “analytics” or “marketing” cookies, so your consent mechanism must allow users to opt in or out of these categories independently.
  • Pre-consent blocking: Your Next.js application must prevent Hotjar’s scripts from executing before consent. This means the tracking code should only be loaded after consent is given, and no Hotjar-related network requests should appear in the browser’s developer tools before that point.
  • Transparent disclosure: Your cookie banner and privacy policy must clearly explain what Hotjar does, what data it collects, and for what purposes. This includes mentioning session recordings, heatmaps, and any third-party data sharing.
  • Easy withdrawal: Users must be able to withdraw consent as easily as they gave it. Your site should provide a mechanism to change cookie preferences at any time, which must stop Hotjar tracking immediately.
  • Documentation: You should maintain records of consent, including timestamps and the specific consent choices made. While this is often handled by a CMP, custom implementations need to log consent events.

Additionally, if you use Google services alongside Hotjar, you may need to consider Google Consent Mode. Consent Mode allows tags to adjust their behavior based on consent state, but it does not automatically cover Hotjar. See Google's consent mode setup guide. You must integrate Hotjar separately with your consent solution. For more on this, see our guide on Google Consent Mode v2.

Common Mistakes and How to Avoid Them

Many Next.js developers make mistakes when implementing Hotjar cookie consent. Here are the most frequent ones and how to avoid them:

1. Loading Hotjar in _document.js Without Consent Check

_document.js runs on the server, so any scripts included there will be sent to the browser immediately, bypassing consent. Always load Hotjar on the client side after checking consent.

2. Using next/script with strategy="beforeInteractive"

This strategy injects the script early, often before consent can be checked. Use afterInteractive or lazyOnload and combine with a consent condition.

3. Not Deleting Cookies on Consent Withdrawal

Simply stopping future tracking is not enough; you must also delete existing Hotjar cookies when consent is withdrawn. Otherwise, the cookies remain and could be seen as non-compliant.

4. Ignoring Hotjar’s “Record” Setting

Hotjar can start recording sessions automatically. Even if you block the main script, if you later initialize Hotjar without checking the user’s recording consent, it may start recording. Ensure that your Hotjar configuration respects consent for recordings specifically, if you offer that as a separate choice.

5. Assuming Google Consent Mode Covers Hotjar

Google Consent Mode only controls Google tags. Hotjar is a separate service and must be integrated independently with your consent solution. For more on this distinction, see our guide on Consent Mode v2 vs Google Certified CMP.

6. Not Updating Privacy Policy

Your privacy policy must disclose the use of Hotjar, including the types of data collected (e.g., mouse movements, clicks, scrolls, IP addresses). Many sites forget to update their policy when adding Hotjar, which is a disclosure gap.

How to Validate with GDPRChecker

After implementing Hotjar Next.js cookie consent, you need to verify that everything works correctly. Manual testing is a good start, but automated scanning catches issues you might miss. GDPRChecker’s scanner is designed to help you close consent gaps by checking:

  • Pre-consent network requests: The scanner loads your site without consent and monitors all outgoing requests. It flags any requests to Hotjar or other third-party domains that occur before consent.
  • Cookie banner behavior: It verifies that your cookie banner appears, that it blocks scripts until action is taken, and that the banner’s categories match the actual cookies set.
  • Disclosure gaps: The scanner can check if your privacy policy mentions Hotjar and whether the cookie descriptions are accurate.
  • Post-change scans: After you make adjustments, run another scan to confirm that previous issues are resolved. This is essential for ongoing compliance as you update your site or consent setup.

To use GDPRChecker, simply enter your Next.js site’s URL and run a scan. The report will highlight any Hotjar-related issues and provide actionable recommendations. This is a practical way to ensure your Hotjar Next.js cookie consent implementation meets regulatory expectations.

Implementation Checklist

Use this checklist to ensure your Hotjar Next.js cookie consent setup is complete:

  1. Remove the default Hotjar snippet from server-rendered files like _document.js.
  2. Create a client-side component that checks consent before loading Hotjar.
  3. Store user consent preferences in a first-party cookie or localStorage.
  4. Block Hotjar script injection until analytics consent is true.
  5. Ensure no Hotjar network requests occur before consent (verify with browser dev tools).
  6. Configure your cookie banner to include an “Analytics” category that controls Hotjar.
  7. Update your privacy policy to disclose Hotjar’s data collection practices.
  8. Implement a mechanism to delete Hotjar cookies when consent is withdrawn.
  9. Test the reject flow: decline analytics cookies and confirm Hotjar is not loaded.
  10. Test the accept flow: accept analytics cookies and confirm Hotjar loads correctly.
  11. Run a GDPRChecker scan to automatically detect pre-consent requests and banner issues.
  12. Document your consent implementation and keep records of consent logs if using a CMP.
  13. Regularly re-scan your site after Next.js or Hotjar updates to catch new issues.

FAQ

What is Hotjar Next.js cookie consent?

Hotjar Next.js cookie consent is the practice of obtaining user permission before loading Hotjar tracking scripts and cookies on a Next.js website. It involves blocking Hotjar until the user explicitly agrees to analytics or marketing cookies, ensuring compliance with GDPR and ePrivacy requirements.

Do I need Hotjar Next.js cookie consent for GDPR?

Yes, if your Next.js site uses Hotjar and serves users in the EU, you need cookie consent. Hotjar sets non-essential cookies for session recording and heatmaps, which require prior opt-in consent under the GDPR. Without it, you risk non-compliance.

How do I implement Hotjar Next.js cookie consent?

Implement by conditionally loading the Hotjar script on the client side after checking consent. Use a CMP or custom logic to read consent preferences, then inject the Hotjar tracking code only if analytics consent is granted. Ensure no Hotjar requests occur before consent.

How can I verify Hotjar Next.js cookie consent with a scanner?

Use GDPRChecker’s scanner to automatically check for pre-consent network requests to Hotjar, verify cookie banner behavior, and identify disclosure gaps. The scanner loads your site without consent and flags any unauthorized tracking, helping you validate your setup.

What are common Hotjar Next.js cookie consent mistakes?

Common mistakes include loading Hotjar in server-rendered components, not deleting cookies on consent withdrawal, assuming Google Consent Mode covers Hotjar, and forgetting to update the privacy policy. These errors can lead to pre-consent tracking and compliance gaps.

Next Steps for Your Next.js Site

Implementing Hotjar Next.js cookie consent is a critical step toward GDPR compliance. By following the steps in this guide, you can ensure that Hotjar only loads after user consent, avoiding unauthorized tracking. Remember to test thoroughly, use automated scanning to catch hidden issues, and keep your disclosures up to date. For more related topics, explore our guides on Google Analytics GDPR compliance and cookie banner requirements.

Ready to validate your setup? Run a GDPRChecker scan today to close consent gaps and keep your Next.js site compliant.

GDPRChecker guides are educational resources and do not constitute legal advice. Use them to understand technical and operational privacy requirements, and consult qualified counsel for legal interpretation.

Check Your Website in Under 60 Seconds

  • Sign in required
  • GDPR-focused checks
  • Cookie banner detection
  • Privacy policy verification