I am trying to set up a GTM container where tags get fired in accordance with the consent given via the Hubspot consent banner.
I have done this many times with cookie management platforms (Cookiebot, Cookieinformation etc.) without any difficulty but these tools have been integrated quite well with GTM (templates/custom events being pushed on consent).
I was hoping I could use the value of the __hs_opt_out cookie as a condition for my tags to fire. As described in these blog posts:
The problem is that a visitors cookie consent only sends tracking data on any additional page views. Data from the first page view where consent given is lost - for GA it could be source and refererrer -
Has anybody solved this predicament? I have found a post regarding the problem but no solution in the Hubspot community.
I hope this can be fixed in Hubspot or GTM without any hardcoding (I am not a developer and my client doesn't have one at hand)?
Maybe some settings can be adjusted in Hubspot (or a script implemented from the account) or a custom HTML tag with the proper code can be used in GTM to fix the issue?
It could basically be anywhere in your source code. Personally I put it after the Hubspot tracking code. If you have added the Hubspot tracking code through a Custom HTML Tag in GTM (as explained here https://knowledge.hubspot.com/reports/install-the-hubspot-tracking-code) you could basically just put it in the same tag as the Hubspot tracking code I suppose.
On another note, will hubspot cookie consent be updating accordingly to consent mode v2 soon?
Also I have this doubt as to what's the best thing to do, as in - if its better to use hubspot for cookie management and ad pixel management and GTM (integrated with Hubspot) with GA4 and other external analytics and ad scripts since HubSpot cannot automatically block cookies from scripts you manually place on the page OR Manage all the ad scripts and other external analytical tool scripts within GTM (integrated with Hubspot) including GA4 and using Hubspot just for cookie management.
But what concerns me is how does Hubspot treat GTM? is it analytical or advertising? Does Hubspot scan all the tags we have in GTM and fire the tags accordingly? (I wish lol)
It could basically be anywhere in your source code. Personally I put it after the Hubspot tracking code. If you have added the Hubspot tracking code through a Custom HTML Tag in GTM (as explained here https://knowledge.hubspot.com/reports/install-the-hubspot-tracking-code) you could basically just put it in the same tag as the Hubspot tracking code I suppose.
Hey @kjetils@KKvistgaard1@KKvistgaard sorry I didn't understand the final solution, is it possible to get the first visit using hubspot tracking code + GTM? Or you have to switch to Cookiebot?
If you managed it with GTM, what was the exact process?
Set the hubspot cookie banner BUT add hubspot tracking code and all the other third parties (google analytics etc.) via GTM? Hubspot tracking code for every page views and the others only when __hs_opt_out != yes?
For now I add the hubspot tracking code via the wordpress plugin, so should I remove that and only use GTM to make this work?
I never found a solution, so I ended up dropping the cookie consent banner from Hubspot. They should fix this.
I use the compliance solution from Cookiebot when I have both external and hubspot hosted domains, since Hubspot has a Cookiebot app and that enableds you to use shared consent across domains/ subdomains.
I'm having the same issue too. It must be possible to have just one cookie policy banner for GA and Husbspot without losing the first page's data fot Google.
In terms of tracking properly in GTM whicle respecting consent (via Hubspot) maybe it could make a difference if the GTM container was implemented via Hubspot (it's hardcoded at the moment)?
The documentation mentions:
Please note: the cookie policy banner blocks HubSpot cookies and cookies from HubSpot integrations, including Google Analytics and Google Tag Manager. HubSpot can only block these cookies if you use the integrations. HubSpot cannot automatically block cookies from scripts you manually place on the page.
Would the GTM container just be blocked without consent and would custom events be made available for triggering all pages tags (as is the custom with the solutions from other Cookie Management Solutions) when consent is given?
Maybe the solution is something completely different?
Please disregard this post. Subdomains are hosted in Hubspot but main domain is external - so I wont be able to implement GTM via Hubspot in terms of the main domain... but I still need to get GTM and the Hubspot consent solution to work on the main domain (works on the hosted subdomains where GTM is also integrated with Hubspot).