GDPR

KKvistgaard
参加者

Hubspot, Google Tag Manager and cookie consent

解決

Hi there

 

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:

https://www.leadstreet.be/en/blog/hubspot-cookies-tutorial-google-tag-manager

 

https://nickwallen.co/2019/12/10/is-your-hubspot-cos-website-gdpr-cookie-consent-compliant/

 

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?

Any help will be VERY appreciated.

Sincerely, 

Kristian 

1件の承認済みベストアンサー
kjetils
解決策
メンバー

Hubspot, Google Tag Manager and cookie consent

解決

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.

元の投稿で解決策を見る

13件の返信
Sanjaysankara
メンバー

Hubspot, Google Tag Manager and cookie consent

解決

Hello all!

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) 

Thank you in advance 

Cheers



kjetils
メンバー

Hubspot, Google Tag Manager and cookie consent

解決

To track the first pageview you can create a custom event trigger in GTM that fires the GA tag.

 

To send the consent custom event to GTM do something like this:

 

window.dataLayer = window.dataLayer || [];
window._hsp = window._hsp || [];
_hsp
.push(['addPrivacyConsentListener', function(consent) {
if (consent.categories.analytics) {
dataLayer.push({'event': 'analytics_cookies_consent'});
}
}]);

 More info here: 

https://developers.hubspot.com/docs/api/events/cookie-banner

https://support.google.com/tagmanager/answer/7679219?hl=en

KKvistgaard1
参加者

Hubspot, Google Tag Manager and cookie consent

解決

Hi Kjetils

Thanks for the follow up.

That is very helpful. 

I have a follow up question, if you don't mind.

Where exactly would you implement this script?

In the header of the source code and before or after the GTM container?

I am not a developer in case the answer to this seems like a noobish question.

Thanks in advance

Kristian
 

0 いいね!
kjetils
解決策
メンバー

Hubspot, Google Tag Manager and cookie consent

解決

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.

tommyz
参加者

Hubspot, Google Tag Manager and cookie consent

解決

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?

 

Thanks in advance for your help

0 いいね!
KKvistgaard1
参加者

Hubspot, Google Tag Manager and cookie consent

解決

Hi Kjetils

Thanks a ton for the solution and clarification.

Much appreciated!

Sincerely,

Kristian

0 いいね!
kvlschaefer
コミュニティーマネージャー
コミュニティーマネージャー

Hubspot, Google Tag Manager and cookie consent

解決

Thanks for sharing, @kjetils


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !
0 いいね!
KKvistgaard1
参加者

Hubspot, Google Tag Manager and cookie consent

解決

@GDuval & @LPetherick 

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.

Otherwise I use Cookieinformation.  

0 いいね!
GDuval
参加者

Hubspot, Google Tag Manager and cookie consent

解決

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. 

Any help would be apreciated. Thanks

0 いいね!
LPetherick
参加者

Hubspot, Google Tag Manager and cookie consent

解決

Im having the same issue. Any help would be apreciated. Thanks

PamCotton
コミュニティーマネージャー
コミュニティーマネージャー

Hubspot, Google Tag Manager and cookie consent

解決

Hello @KKvistgaard, I will add some top experts to share their ideas, @himanshurauthan @Phil_Vallender any recommendations to @KKvistgaard matter?

 

Thank you,

Pam

Você sabia que a Comunidade está disponível em outros idiomas?
Participe de conversas regionais, alterando suas configurações de idioma !


Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !




KKvistgaard
参加者

Hubspot, Google Tag Manager and cookie consent

解決

Hi Pam &  @himanshurauthan @Phil_Vallender

Thanks for the assistance. 

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 notethe 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.

https://knowledge.hubspot.com/reports/customize-your-cookie-tracking-settings-and-privacy-policy-ale...

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?

Sincerely, 


Kristian

KKvistgaard1
参加者

Hubspot, Google Tag Manager and cookie consent

解決

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).

Hope for your assistance