Modification gestion des cookies

This commit is contained in:
SylvainLelievre 2021-11-24 07:18:29 +01:00
parent 39aaa035b4
commit 020da0f9e3
2 changed files with 26 additions and 27 deletions

View File

@ -235,10 +235,9 @@ core.start = function() {
// Crée le cookie d'acceptation Google Analytics si nécessaire
var analytics = "<?php echo $this->getData(['config', 'seo', 'analyticsId']);?>";
if( analytics.length > 0){
document.cookie = "ZWII_COOKIE_CONSENT_GA=" + $("#googleAnalytics").prop("checked") + ";" + domain + ";" + path + ";" + samesite + ";" + expires;
document.cookie = "ZWII_COOKIE_GA_CONSENT=" + $("#googleAnalytics").prop("checked") + "<?php echo $_SERVER['PHP_SELF']; ?>" +";" + domain + ";" + path + ";" + samesite + ";" + expires;
}
//document.cookie = "ZWII_COOKIE_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
document.cookie = "ZWII_COOKIE_CONSENT=<?php echo str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF'])); ?>;" + domain + ";" + path + ";" + samesite + ";" + expires;
document.cookie = "ZWII_COOKIE_CONSENT=<?php echo $_SERVER['PHP_SELF']; ?>;" + domain + ";" + path + ";" + samesite + ";" + expires;
});
$("#cookieConsent .cookieClose").on("click", function() {

View File

@ -1173,7 +1173,7 @@ class common {
*/
public function showAnalytics() {
if( !empty($code = $this->getData(['config', 'seo', 'analyticsId'])) &&
$this->getInput('ZWII_COOKIE_GA_CONSENT') === 'true_'.str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF']))) {
$this->getInput('ZWII_COOKIE_GA_CONSENT') === 'true'.$_SERVER['PHP_SELF']) {
echo '<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id='. $code .'"></script>
<script>
@ -1190,7 +1190,7 @@ class common {
*/
public function showCookies() {
if( $this->getInput('ZWII_COOKIE_CONSENT') !== str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF'])) AND
if( $this->getInput('ZWII_COOKIE_CONSENT') !== $_SERVER['PHP_SELF'] AND
$this->getData(['config','cookieConsent']) === true
){