-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persist consent state in session #51
Comments
initCommands only must be triggered one time!!! maybe initCommands are triggered in each request... its incorrect, consent mode default only must be setted one time (until user remove/expired cookies) |
With this config gtag: { the initCommands are triggered in each request, the initCommands only must me triggered only time in session... not only one in each request |
Indeed, |
https://stackblitz.com/edit/nuxt-starter-doubb6 put your ids in nuxt.config.ts gtag section and press acept or denied and goes to another page... a default consent event is triggered |
I'm using Analytics Debugger chrome extension In first url, the last action is acept consent mode, and we triger consent with granted. The event #5 in second url is a HACK that we are trying |
If i remove Toxic consent default event dissapears!!! init commands only must be triggered until consent mode is pending... if consent mode its updated, initCommands musnt be triggered |
The module follows the consent mode specs: // 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'
}); For the plain Google example, a Redirect from How are you using Nuxt that you require a hard refresh? Feel free to open a PR to support state persistance, say in |
Now, we use Nuxt in "non mode spa mode" the persistance state must be a cookie, not its for a session... maybe you can define expires in a ttl nuxt.config.ts property |
Thanks for all the screenshots!
That doesn't seem the case. To state the Gtag docs: Note To adjust the default measurement capabilities, call the |
Our google account manager tell us that isn't necessary... but we confirm with him this behaviour |
In any case, if it is issued, the selected option should be issued, not the consent mode default |
@johannschopplich Or maybe create a new functionality like the useTrackEvent that is useConsentUpdated and if used, save the saved options and instead of emitting a default denied on each page, emit the option that was last used |
@agracia-foticos I'm sorry, but I don't follow. The Do you run the consent update before the |
We are Nuxt without SPA mode, therefore every time we load a page, we are issuing a default denied and later an updated granted, which is driving the algorithm crazy. |
I had a similar issue not long ago, when using together with nuxt cookie-control. IMO the initCommand is correct, and according to spec. Each new page load (or reload) WILL reset the consent. What you need to do is to listen to the cookie that stores if Google Analytics is consented or not in your website, and update accordingly.
This will ensure that returning users and page reloads will be updated to the consent state. Hope it helps. |
Environment
Linux
v20.5.1
3.10.3
3.10.1
2.9.0
npm@9.8.0
-
-
-
-
Reproduction
First consent mode default

Cookie banner acept partial consent

But when we navigate, there is a toxic consent that we havent triggered!!

There is a bug in the module??? Module throws this event???
Describe the bug
First consent mode default

Cookie banner acept partial consent

But when we navigate, there is a toxic consent that we havent triggered!!

There is a bug in the module??? Module throws this event???
Additional context
No response
Logs
No response
The text was updated successfully, but these errors were encountered: