nuxt-community / google-gtag-module

Enable google gtagjs for NuxtJs
MIT License
145 stars 29 forks source link

How can I set window['ga-disable-UA-XXXX-XX'] to true initially #20

Open moritzlaube opened 4 years ago

moritzlaube commented 4 years ago

I'd like to implement an Opt-In component in my nuxt app to actively opt into Google Analytics Tracking (due to European DSGVO regulation). Is there a way to set window['ga-disable-UA-XXXX-XX'] = true initially to prevent gtag() to start tracking?

Only when the user hits an agree-button the i'd like to set window['ga-disable-UA-XXXX-XX'] = false programmatically in my Nuxt-component. Is that possible, too?

Thanks for helping out.

dohomi commented 4 years ago

try with disableAutoPageTrack and then modify tracking in your main app similar what explained here: https://github.com/nuxt-community/google-gtag#to-make-sure-that-every-page-is-tracked-correctly

toniengelhardt commented 4 years ago

The problem is that even with disableAutoPageTrack set to true the gtag cookie is still set. Is there a way to avoid that?

itpropro commented 4 years ago

This is the most important functionality, otherwise no one can use this module on their website without being sued (in worst case). Even, if you ask people for their consent, you are not allowed to enable any analytics or tracking before the user has actually clicked yes. Otherwise it would be a violation of EU ePrivacy directive, GDPR or both. This applies to all websites, no matter where they are hosted, as long as european citizens are part of the target group of that website. It would be great, if someone could answer how this kind of behavior can be configured using this nuxt module. If it's not possible I have to use gtag natively and use the provided window['ga-disable-GA_MEASUREMENT_ID'] = true; method.

bjwieland commented 4 years ago

This is the only (not quite good) solution working for me at the moment. This is the code within my cookie component...

accept() { if (process.browser) { localStorage.setItem("GDPR:accepted", true) window['ga-disable-UA-0000000-1'] = false window.location.reload() } },

Snake231088 commented 3 years ago

Any update?