You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I built a custom cookie banner and am trying to make it work with GTM Consent Mode.
In nuxt.config.ts, I've got the following config:
scripts: {registry: {googleTagManager: {id: '...',trigger: 'onNuxtReady',bundle: false,// Required to make Tag Assistant (Preview Mode) workdefaultConsent: {// https://developers.google.com/tag-platform/tag-manager/templates/consent-apisad_storage: 'denied',ad_user_data: 'denied',ad_personalization: 'denied',analytics_storage: 'denied',// Start denied, update when analytics accepted through useCookieConsentfunctionality_storage: 'granted',// Always grantedpersonalization_storage: 'denied',security_storage: 'granted',// Always granted},},},},$development: {scripts: {registry: {googleTagManager: 'mock',},},},
In my app.vue, I've got something along the lines of:
// Initialize cookie consent managementconstgtm=useScriptGoogleTagManager()gtm.onLoaded(()=>{console.log('Google Tag Manager loaded, initializing consent status')gtm.consent?.update({analytics_storage: 'denied',// Default to denied until user gives consent})})onMounted(()=>{setTimeout(()=>{console.log('Updating consent status to granted for analytics_storage')gtm.consent?.update({analytics_storage: 'granted',})},2000)})
I've done this in an attempt to debug the consent mode. In reality, I have a composable (useCookieConsent()) that would track cookie banner consent in a reactive which I watch on for changes, which in turn will to the consent update.
For some reason my tags are always loaded even initially, when cookies should be rejected. This is why I am trying to debug it using the Tag Assistant. However, the Tag Assistant never shows anything related to consent as seen in the following screenshot. Neither the default consent nor the consent update appear. As I understand it, it should display the configured consent in the consent (Einwilligung) tab, as well as show a consent event on the left.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I built a custom cookie banner and am trying to make it work with GTM Consent Mode.
In
nuxt.config.ts, I've got the following config:In my
app.vue, I've got something along the lines of:I've done this in an attempt to debug the consent mode. In reality, I have a composable (
useCookieConsent()) that would track cookie banner consent in a reactive which I watch on for changes, which in turn will to the consent update.For some reason my tags are always loaded even initially, when cookies should be rejected. This is why I am trying to debug it using the Tag Assistant. However, the Tag Assistant never shows anything related to consent as seen in the following screenshot. Neither the default consent nor the consent update appear. As I understand it, it should display the configured consent in the consent (Einwilligung) tab, as well as show a consent event on the left.
Any ideas what I might be doing wrong?
Beta Was this translation helpful? Give feedback.
All reactions