Introduction
Updated for 2026 compliance practices.
When you integrate HubSpot tracking into a Next.js website, managing cookie consent becomes a critical compliance step. HubSpot Tracking Next.js cookie consent is a practical compliance topic for website owners validating consent, tags, and disclosures. This guide walks you through the technical implementation, explains what consent means for your HubSpot scripts, and shows you how to verify everything works correctly—without giving legal advice. We focus on actionable steps you can take today to align with GDPR expectations, using official references and the GDPRChecker scanner to confirm your setup.
Requirements and Compliance Expectations
To align with GDPR when using HubSpot tracking on Next.js, you need to meet several technical and operational requirements. These are based on general principles from the GDPR and guidance from authorities like the European Data Protection Board (EDPB).
Consent Must Be Freely Given, Specific, Informed, and Unambiguous
Your cookie banner must clearly explain what data HubSpot collects and for what purposes. Pre-ticked boxes or implied consent (e.g., “by continuing to browse you agree”) are not valid. The user must take a clear affirmative action, such as clicking an “Accept” button.
Prior Consent Means No Tracking Before Opt-In
This is the most critical technical requirement. You must block all HubSpot tracking requests until consent is obtained. This includes: - The initial script load from js.hs-scripts.com. - Any subsequent API calls or cookie-setting operations. - HubSpot forms or live chat widgets that may set cookies.
In Next.js, you can achieve this by using a consent management platform (CMP) or a custom consent state that controls when the script is injected. If you use Google Tag Manager (GTM) to load HubSpot, you must configure triggers that fire only on consent. For more on GTM and consent, see our guide on Google Consent Mode V2.
Granular Consent Options
Visitors should be able to choose which categories of cookies they accept. For example, they might accept necessary cookies but reject analytics or marketing cookies. HubSpot tracking typically falls under analytics or marketing, so you need a way to separate it from strictly necessary scripts.
Easy Withdrawal of Consent
Users must be able to change their mind as easily as they gave consent. Provide a persistent link or button (e.g., “Cookie Settings”) that reopens the consent banner, allowing them to disable HubSpot tracking at any time.
Documentation and Accountability
You must be able to demonstrate that consent was obtained. This means logging consent choices and ensuring your setup is verifiable. The GDPRChecker scanner can help you document that your site behaves correctly by scanning for pre-consent requests and cookie presence.
Common Mistakes and How to Avoid Them
Even experienced developers make mistakes when implementing HubSpot Tracking Next.js cookie consent. Here are the most frequent pitfalls and how to steer clear of them.
1. Loading HubSpot Script Unconditionally
A common error is adding the HubSpot script directly in _document.js or _app.js without a consent check. This causes the script to load for all visitors, setting cookies before any consent is given. Always wrap the script in a conditional that respects the consent state.
2. Ignoring Pre-Consent Network Requests
Some setups block the main script but forget about other HubSpot features like embedded forms or live chat. These may make API calls that set cookies. Audit all HubSpot integrations on your site and ensure they are all consent-gated.
3. Not Clearing Cookies on Consent Withdrawal
If a user opts out, simply hiding the script isn’t enough. Existing cookies remain and can still be used for tracking. Implement a cookie-clearing mechanism as described above.
4. Using Implied Consent or Dark Patterns
Designing a banner where “Accept All” is prominent and “Reject All” is hidden or requires multiple clicks is considered a dark pattern and violates GDPR. Make both options equally easy to access. For more on banner design, check our cookie banner requirements guide.
5. Failing to Test with a Scanner
Manual testing can miss edge cases. Use the GDPRChecker scanner to automatically detect pre-consent requests, cookie violations, and disclosure gaps. It simulates a first-time visitor and checks what fires before any consent is given, giving you a clear report.
6. Overlooking Next.js Specifics
Next.js renders pages on the server and client. If you use server-side rendering (SSR) or static generation (SSG), be careful not to include consent-dependent scripts in the initial HTML. Use client-side only loading with next/script and the strategy prop, or dynamic imports with { ssr: false }.
Implementation Checklist
Use this checklist to ensure your HubSpot Tracking Next.js cookie consent implementation is complete and verifiable.
- Audit all HubSpot scripts and features: List every place where HubSpot tracking, forms, or chat are used.
- Choose a consent management approach: Decide between a CMP or a custom solution.
- Implement a consent banner: Design a banner that allows granular choices and is equally accessible for accept and reject.
- Store consent state: Use a cookie or localStorage to persist user choices.
- Conditionally load HubSpot script: Only inject the tracking script when analytics/marketing consent is given.
- Block all pre-consent requests: Ensure no HubSpot network activity occurs before consent.
- Handle consent withdrawal: Provide a way to revoke consent and clear HubSpot cookies.
- Integrate with Google Consent Mode (if needed): Adjust Google tags based on consent state.
- Test manually: Use browser dev tools to check network requests and cookies before and after consent.
- Run a GDPRChecker scan: Verify pre-consent behavior and banner detection.
- Update your privacy policy: Clearly disclose HubSpot’s data collection and how users can manage consent.
- Document consent logs: Keep records of consent choices for accountability.
FAQ
What is HubSpot Tracking Next.js cookie consent?
HubSpot Tracking Next.js cookie consent refers to the practice of obtaining user permission before loading HubSpot tracking scripts and setting cookies on a Next.js website. It ensures compliance with GDPR by blocking analytics and marketing cookies until the visitor explicitly agrees, using a consent banner and conditional script loading.
Do I need HubSpot Tracking Next.js cookie consent for GDPR?
Yes, if your Next.js site uses HubSpot tracking and serves visitors in the EU, you need cookie consent. HubSpot’s cookies are not strictly necessary for the website to function, so they require prior opt-in consent under GDPR. This applies to the main tracking script, forms, and live chat cookies.
How do I implement HubSpot Tracking Next.js cookie consent?
Implement by first choosing a consent management platform or building a custom solution. Then, conditionally load the HubSpot script only after consent is given, using Next.js’s Script component. Ensure no tracking requests fire before consent, handle consent withdrawal, and clear cookies when consent is revoked.
How can I verify HubSpot Tracking Next.js cookie consent with a scanner?
Use the GDPRChecker scanner to crawl your site as a new visitor. It checks for pre-consent network requests to HubSpot domains and verifies that no tracking cookies are set before consent. The report highlights any issues, allowing you to fix them and re-scan for confirmation.
What are common HubSpot Tracking Next.js cookie consent mistakes?
Common mistakes include loading the HubSpot script unconditionally, ignoring pre-consent requests from forms or chat, not clearing cookies on consent withdrawal, using dark patterns in the banner, and failing to test with a scanner. These can lead to non-compliance and should be avoided through careful implementation and verification.
Copyright and editorial notice
© GDPRChecker
This original AI-assisted editorial draft was selected, reviewed, and published by GDPRChecker. All rights are reserved where protected by applicable law. Do not reproduce the article without permission.