Google Consent Mode v2 implementation

Hello
Description:
I tried to implement the Google Consent Mode v2 solution from the hubspot for our marketing agency website.
We use a Hubspot Cookie banner
I turned on the integration according to

I even tried to insert JS code from here in the <head>
the same
Bug:
But there is a bug.
When I try to run and verify via GoogleTagManager how the banner convey variables ‘analytics_storage’, ‘ad_storage’,‘ad_user_data’, ‘ad_personalization’
I see that when the consent on the banner is granted - GTM works. But I do not see these variables in the consent tab
If the consent on the banner is not granted - GTM does not work at all - but in fact we must see “denied”
Question:
Do I have to wait for the Hubspot solution?
Or maybe I have I edit the hubspot banner code manually :
-set on click functions for example

function consentGrantedAdStorage() {

gtag('consent', 'update', {

  'ad\_storage': 'granted'

});

}

</script>
Or probably it is worth to insert the code in the <head> manually?:

<script>

// Define dataLayer and the gtag function.

window.dataLayer = window.dataLayer || [];

function gtag(){dataLayer.push(arguments);}

// Set default consent to ‘denied’ as a placeholder

// Determine actual values based on your own requirements

gtag(‘consent’, ‘default’, {

'ad\_storage': 'denied',

'ad\_user\_data': 'denied',

'ad\_personalization': 'denied',

'analytics\_storage': 'denied'

});

</script>

Hi, @RYeliseikin :waving_hand: Thanks for your question. If you believe you’ve found a bug, you might post about it here, as the PM for this rollout is active in the thread.

As for troubleshooting steps:

  • have you already used GTM’s Preview and Debug mode to verify that the consent status variables (analytics_storage, ad_storage, ad_user_data, ad_personalization) are correctly being updated?
  • have you tried adding custom onClick functions that trigger gtag(‘consent’, ‘update’, {…}) with the appropriate consent statuses?
  • when adding to the <head> section, have you tried placing some scripts below the HubSpot banner script or ensuring they’re executed in response to specific consent events?

Thanks for the additional information! — Jaycee

Thank you, Jaycee_Lewis
Answers
1. Yes, I tried . I used GTM’s Preview Mode
-In one case (w-4.ch) - I cannot see the gtm container

-For the second website (https://www.zurzachcare.ch/) - after I closed the coockie banner once - I did not see it again .
And in GTM I see the message "Consent not configured

Default consent state has not been set yet"

2. Did not try.
3. Yes below - the section Site header HTML places scripts below the HS banner code
I tried to insert JS code from here in the <head>

Questions:
1. For websites that use a Hubspot banner - should we take some special steps in GTM related to the consent?
2. the second question: If we deny cookies - GTM does not work at all (in the Preview mode)
I checked the news about the final relise
But it works with cookies - might it be that it does not work with GTM?
For example a piece of code on our website

I mean in case of window._hsGtmLoadOnce = true the code is not executed. I.e. it is being executed 1 time and then returns.

if(window._hsGtmLoadOnce) {
return;
}

But it means that GTM id not loaded the 2 time and more, Yes?
Thank you