Since our website is fully hosted on HubSpot CMS, we are currently facing a technical challenge regarding the integration of our Didomi cookie consent banner.
Because HubSpot automatically injects its own tracking pixel (hs-script-loader) in the background across all pages, it is impossible for us to directly modify its HTML tag on the fly.
To ensure GDPR compliance, we integrated the Didomi script into the header, along with an additional script combining the HubSpot JavaScript API (_hsq.push and _hsp.push) to force the native pixel to respect the user’s choices.
To validate this setup, we ran a series of tests in incognito mode and are observing some specific behaviors:
Before consent (Banner is displayed):
The technical cookie __hs_do_not_track immediately sets to yes.
In the Network tab, tracking is successfully blocked: no requests are sent to track.hubspot.com.
However, in the Application tab, HubSpot session cookies (hubspotutk, _hstc) are still visually generated by default by the CMS from the very first millisecond, even though they remain inactive and frozen until the user interacts.
After refusal (Clicking “Reject All”):
The banner disappears, the __hs_do_not_track cookie remains at yes, and network tracking stays completely silent.
After acceptance (Clicking “Accept All”):
Our listener script reacts dynamically, and the __hs_do_not_track variable disappears, releasing HubSpot tracking without needing a page reload.
My questions for the developers and experts in the community:
Is it normal and considered “GDPR compliant” that HubSpot CMS visually drops cookie structures (hubspotutk, _hstc) in the browser before consent, as long as the __hs_do_not_track cookie is active and no network requests are emitted?
Is there a native setting in the HubSpot CMS settings to completely prevent these system cookies from appearing before any interaction with an external CMP, or is this JavaScript API approach (doNotTrack) the only possible way in this specific configuration?
Thank you in advance for your insights and feedback!
Is it normal and considered “GDPR compliant” that HubSpot CMS visually drops cookie structures (hubspotutk, _hstc) in the browser before consent, as long as the __hs_do_not_track cookie is active and no network requests are emitted?
I’m not a legal advisor, but I’d say yes - it’s normal but not GDPR compliant in Germany and France.
As for disabling the HubSpot cookies before consent, I would do it like this:
Select the “Manage” option in the Actions dropdown of your connected domain
Edit the HubSpot cookie banner you’d like to edit (you can have several ones)
In the second step of the editor, you can set it to Opt-in and allow opt-ins by category
Click Publish
Done
Since you’re using Didomi, it’s required to add some code (if you haven’t already) so it goes hand-in-hand with HubSpot.
For enabling tracking if a visitor hits “allow cookie”, you need an event listener like this:
// Didomi Consent Granted Handler
window._hsp = window._hsp || [];
window._hsp.push(['addPrivacyConsentListener', function(consent) {
// something that will be called, when visitor consent to tracking
}]);
Please note that the absence of requests to track.hubspot.com doesn’t necessarily confirm GDPR compliance, especially if analytics cookies like hubspotutk and _hstc are being set before consent.
Here are a few things I’d recommend checking:
Review your cookie settings: Go to Settings > Privacy & Consent > Cookies and ensure your policy requires opt-in consent rather than simply displaying a notification.
Sync consent with Didomi: Since you’re using Didomi, consider passing consent preferences to HubSpot through the HubSpot Cookie Banner API.
Test again: After configuring consent, test in a fresh incognito session to confirm that analytics cookies aren’t created and tracking requests aren’t sent before consent. Some strictly necessary cookies may still be present.