To be able to use the hasAgreed() function, I relied on the observer pattern provided by the library
It can be done this way in order to declare a function which will be called after the cookie value has been loaded and the hasAgreed function works.
(beware, it is actually called twice, so you may want to protect your function against being called twice)Drupal.eu_cookie_compliance("postStatusLoad", function postLoadHandle(scope,o) { if (Drupal.eu_cookie_compliance.hasAgreed()){ //GOOGLE ANALYTICS CODE } else { // DISABLE GOOGLE ANALYTICS CODE } });
Hello everyone,
I got this task to make our web site from work GDPR compliant.
if (!Drupal.eu_cookie_compliance.hasAgreed()){ window['ga-disable-UA-XXXXXXXX-1'] = true; } ga("send", "pageview");
So here we are, they gave me the drupal user and I need to find solution.
First time I work with Drupal and I try already with days to fix the issue.
As i dont understand where I have to put the above functionalities for disabling the Google Analytics ,
can some one point me where exactly I need to put the code?
I am trying in the Header Footer Scripts Settings in the configuration of Drupal,
and here where the google analytics is set, under neath I am putting this code:But still when i try to check the web site, the report is coming back for Google Analytics:
Blocked until accepted by user: No
I would much appreciate any help cause I am already stuck with days and I need to fix this issue asap.
Thank you