Account created on 25 September 2018, over 6 years ago
#

Recent comments

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
  }
  });
Production build 0.71.5 2024