This post from a few years ago is the only one I could find that’s related. We use a 3rd party cookie consent banner (Usercentrics, but not important) and the Hubspot Wordpress plugin to display forms. When we were asked to implement consent v2, we were surprised to see that the plugin also drops a tracking cookie. Is there a recommendation about disabling the tracking until the user consents, while still supporting the form display and data handling even if they don’t?
Hey @JLP,
Welcome to the Community!
HubSpot’s tracking code API does have a doNotTrack method that can be used to suppress tracking until consent is given. I’d suggest starting by looking at the doc I’ve included here:
Here are some resources that should help point you in the right direction:
- Cookies set in your visitor’s browser by HubSpot
- Set up cookie tracking settings and consent banners
- Disable HubSpot tracking code with WordPress plugin (the thread you found has some useful solutions in the replies)
I’d also like to tag in some of our Top Contributors to see if they’ve worked through this before!
Hey @danmoyle, @michaelma, @rebeccatravels – Do you have any suggestions for @JLP on this?
Thanks in advance!
Sam, Community Manager
Thanks. I did see those before but I assumed it would only work with HB’s own consent banner, but I see if you scroll down there’s a section about 3rd party ones. I’ll take a look.
That doc is actually about using the Hubspot Constent banner. Even the “3rd party” section assumes you’re at least initializing the banner so that you can use the banner’s js methods to enable/disable.
We’re using the plugin for displaying forms and want to be able to display those forms while blocking tracking unless the user consents. Is that even possible or should we look at another solution. Either switching to embedding the HubSpot forms js via GTM instead without tracking, or some API solution maybe.
Hey @JLP!
yes, this is the recommended approach. If users haven’t provided consent, you should prevent the HubSpot tracking code from loading while still allowing the form to display and accept submissions.
HubSpot forms can function without the tracking cookie, but features like visitor tracking and analytics won’t be available until consent is granted.
If you’re using Usercentrics or another CMP, I’d recommend configuring it to load the HubSpot tracking code only after the appropriate consent has been given. This allows you to remain compliant while keeping the form fully functional.
thanks @CarolinaDeMares That’s the approach I’m trying to get to. We’re using the Wordpress plugin, and I don’t see any setting that lets me prevent the plugin from initially dropping the tracking cookies (so we could then enable when consent is given). The WP plugin isn’t the right choice if you need to set up a consent banner.
This support page says:
It is strongly recommended that you install and use the HubSpot All-in-One Marketing - Forms, Pop-ups, Live Chat WordPress plugin. The plugin automatically installs the HubSpot tracking code on your WordPress website for you.
I’d separate the form embed from the tracking script.
The form can still render and submit without treating the visitor as trackable for analytics. The part that should be consent-gated is the HubSpot tracking code / cookie-setting path, not necessarily the form itself.
The setup I’d test is:
- Let the WordPress plugin handle the form embed.
- Use Usercentrics to block HubSpot tracking until the right consent category is accepted.
- On accept, load/enable the tracking script and confirm a new page view is tracked.
- On decline, confirm the form still submits but no HubSpot tracking cookie is created.
The edge case is that some attribution fields will be missing for no-consent submissions. That is expected; I would rather keep the submission and lose analytics attribution than block the form completely.
Yeah that’s our plan. I don’t think there’s a way for Usercentrics to block the tracking however. The plugin queues the tracking script along with the forms script. The cookies are set at that point.
What we’ve done is de-queue and de-register the plugin’s tracking script in functions.php – a hacky way of doing what I think the plugin should offer as a simple checkbox. Then we added that script to GTM so that it gets handled by the consent banner response.
We’ll lose some page data that maybe we’ll try to add back using the dataLayer. TBD.
Hard to see what the plugin gives us at this point. We can just as easily add embed code on the pages we need.