Closed (duplicate)
Project:
Google Analytics
Version:
7.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 May 2018 at 12:26 UTC
Updated:
10 Jul 2019 at 15:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
phjouComment #3
hass commentedThere has nothing been decided in #2917905: Add JS-function / method to set ga-disable-....
This is not the api way. We may need to write a js plugin and ther is also a gs disable feature.
Comment #4
phjouComment #5
phjouSorry I chose the wrong word, not decided indeed. We need to move the initialization of the script tag from the PHP to a JS Plugin?
I've seen that the gs disable feature does not send data to google but does it also block cookies?
Comment #6
hass commentedI think it blocks running the code, so no cookie can be set as the code does not run. Not verified myself yet, but only this makes sense.
Comment #7
gmaximus commentedThank you @phjou. Works for me!
Comment #8
gmaximus commentedJust noticed that this patch in #2 doesn't remove the cookie if consent is withdrawn. It is part of the new features in dev for the eu_cookie_compliance module. Any ideas?
Comment #9
gmaximus commentedI changed the last function in the patch to this
Now it will delete cookies when consent is withdrawn. Wasn't sure of how to create a patch and with GDPR I'm a little stretched for time.
Comment #10
gmaximus commentedI edited the original patch to include my changes
Comment #11
MaskOta commentedThe code from the patch seems to work. However i did have problems applaying the patch.
Here is a reroll. I also changed the module_enable function to module_exists beacause:
a) i dont think we should enable modules for users
b) module_exists is much faster on each run (noticed while debuging)
Comment #12
gmaximus commentedThank you @MaskOta. Good spot. I didn't look up the module_enable function. I thought that is what it was doing.
Comment #13
gmaxwelled commentedWorked for me, thanks.
Comment #14
luksakDoes anyone have a working version for D8?
Comment #15
phjouThere is no working D8 patch for now, but the D8 issue is there: https://www.drupal.org/project/google_analytics/issues/2917905
There is also an issue in eu_cookie_compliance: https://www.drupal.org/project/eu_cookie_compliance/issues/2933614
Comment #16
rob c commentedI just uploaded a D7 patch to #2976470: cookie is set before accepting that uses ga-disable + i believe we can fix it there + this patch did not work for me.
Comment #17
klabautermann_ commentedTried to port the patch #11 to D8.
Works for me, but is not really tested yet. Also I had to create a get_settings function in eu_cookie_compliance module. I do not know if it is the recommended way. I did not get to manage the customizability with a checkbox in google_analytics module. With this patch, tracking cookies are only set when User accepts eu_cookie_compliance.
Comment #19
klevyke commentedThe patch #11 works for me. Thanks!
The only minus is that the first visit isn't tracked this way.
I tried to make a patch to solve this problem. This loads the analytics script when the user clicks on Agree button.
Comment #20
subhojit777Changing to Needs review as the tests have passed.
Comment #22
subhojit777whitespaces removed
Comment #23
mpadilla commentedThe patch #22 works for me. Thanks!
Comment #24
heddnThe url should be a link.
English suggestion:
If enabled, the Google Analytics module will not track users as long as we do not have their consent.
Whitespace nits. Things should move back to the left.
Comment #25
phjouJust did the patch with the corrections listed by @heddn in #24
Comment #26
phjouI selected my old patch. Sorry, this one is the good one :)
Comment #27
phjouComment #28
phjouSomething just came up my mind.
Should we rollback what have been done in #19 ? If we want to track the first visit, we have the Reload page after user clicks the "Agree" button. feature from Eu Cookie Compliance. We could keep less code. What do you think?
Comment #29
heddnIf EU has it, then no need to add a feature for EU cookies to GA. Let's nix it. And don't forget an interdiff, I don't want to have to re-review the entire patch.
Comment #30
phjouOk so I've based the new patch on #11.
- I've drop all the code from #19 because Eu cookie compliance allow us to reload the page and track it and also #22 because it was some code styling on #19.
- I've kept the transformation into a link from #26
I've attached Interdiff files this time. Sorry.
Comment #31
phjouComment #32
heddnSo close. Looking a real good here. However, this would ready more clearly if we re-ordered the english and put in another verb:
If enabled, the Google Analytics module will not track users as long as we do not have their consent...
Comment #33
phjouI changed the english :)
Comment #34
phjouComment #35
heddnLet's try RTBC on for size? I think this will work now.
Comment #36
anybodyConfirming RTBC. This is a great feature and step forward, thank you all! Hopefully this will be part of the next release.
Comment #37
anybodyComment #38
cheope commentedGreat! Patch in #33 works like a charm! Thank you very much! :-)
Comment #39
frankdesign commentedPatch at #33 works perfectly. Please commit.
Thanks
F
Comment #40
jcnventuraRTBC++
Comment #41
johncionci commentedIs there a patch for D8?
Comment #42
phjou@johncionci: Yes there is one => # 2917905Add JS-function / method to set ga-disable-...
Comment #43
johncionci commented@phjou Thanks!
Comment #44
hass commentedComment #45
hass commentedCode looks like a duplicate of #2917905: Add JS-function / method to set ga-disable-....
Comment #46
jcnventura@hass: it's not a duplicate in the sense that this is for D7, and that other issue is covering the D8 issue. Normally both patches are developed in the same issue, but that trend was not followed here. Closing this issue without adding the D7 patch to #2917905: Add JS-function / method to set ga-disable-... is worse than having two open issues on the same problem.
Comment #47
jummonk commentedPatch #33 does not seem to work anymore with version 7.x-1.27 of eu_cookie_compliance.
Comment #48
romdouze commentedHi all,
thank you very much for this great work !!
It's ok for me with:
D7 core v7.64
Eu-cookie-compliance v7.x-1.28
GA v7.x-2.6
Thank you again !
Comment #49
travis-bradbury commentedThere seems to be a conflict between this and advanced aggregation because it wrapped the ga code in two layers of the delete_cookie and checktracking functions.
Even if that isn't this issue's fault, this one needs work because it's only going to work until the moment something changes in eu_cookie_compliance. This module should provide a way for that module - or others - to decide to disable tracking, not do the checks itself.
You can also have eu_cookie_compliance set to opt-in by default and not disable any scripts/tracking and this patch will still disable google analytics.
Comment #50
anybodyPlease try the patch in #3060312: Better GDPR compliance: Fix Do not track & EU Cookie Privacy integration which provides integration for EU Cookie Compliance in the UI combined with Do-Not-Track. I'd like to have your help with tests there and your feedback, if it fixed your problems. If yes, we can close this as duplicate perhaps.
Please note that you will need the patch from #2986131: JS loads too late to affect Google Analytics #7.
Comment #51
anybodyThis is fixed for 7.x-2.x in #3060312: Better GDPR compliance: Fix Do not track & EU Cookie Privacy integration please help to review / test.