drupal - How to check from google analytics module if user gave permission for cookies on eu-cookie-compliance module -
so have google analytics module , eu-cookie-compliance module, both working fine. i'm trying disable google analytics if user didn't give permission cookies on eu-cokie-compliance. know cookie module has javascript function
drupal.eu_cookie_compliance.hasagreed() but have check php code in google analytics. when page first load google analytics disabled.
any ideas how make work?
<?php $cookie=$_cookie['cookie-agreed-sl']; if($cookie==1 || $cookie==2)return true; else return false; ?> so added code google analytics code returnss false google analytics cookie newer set. tried code in php file , there works. how fix it?
the eu_cookie_compliance logic can found in javascript file: js/eu_cookie_compliance.js contains eu_cookie_compliance_get_settings:
drupal.eu_cookie_compliance.setstatus = function(status) { var date = new date(); date.setdate(date.getdate() + 100); document.cookie = "cookie-agreed-"+drupal.settings.eu_cookie_compliance.popup_language + "="+status+";expires=" + date.toutcstring() + ";path=" + drupal.settings.basepath; } so have cookie using php.
Comments
Post a Comment