Gestion des cookies

This commit is contained in:
fredtempez 2022-01-25 11:36:11 +01:00
parent ee91af4bdc
commit 199022a244

View File

@ -212,12 +212,11 @@ core.start = function() {
*/
$("#cookieForm").submit(function(event){
// Varables des cookies
var samesite = "samesite=lax";
// Variables des cookies
var getUrl = window.location;
var domain = "domain=" + getUrl.host;
var path = "path=" + getUrl.pathname.split('/')[1];
var samesite = "samesite=lax";
var domain = "domain=" + getUrl.host + ";";
var path = "path=" + getUrl.pathname.split('/')[1] + ";";
var e = new Date();
e.setFullYear(e.getFullYear() + 1);
var expires = "expires=" + e.toUTCString();
@ -226,18 +225,18 @@ core.start = function() {
var analytics = "<?php echo $this->getData(['config', 'seo', 'analyticsId']);?>";
// l'Id GA est défini dans la configuration, afficher la checkbox d'acceptation
if( analytics.length > 0){
// Traitement du retour de la checkbox
// Traitement du retour de la checkbox
if ($("#googleAnalytics").is(":checked")) {
// L'URL du serveur faut TRUE
document.cookie = "ZWII_COOKIE_GA_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
document.cookie = "ZWII_COOKIE_GA_CONSENT=true;samesite=strict;" + domain + path + expires;
} else {
document.cookie = "ZWII_COOKIE_GA_CONSENT=false;" + domain + ";" + path + ";" + samesite + ";" + expires;
document.cookie = "ZWII_COOKIE_GA_CONSENT=false;samesite=strict;" + domain + path + expires;
}
}
// Stocke le cookie d'acceptation
document.cookie = "ZWII_COOKIE_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
document.cookie = "ZWII_COOKIE_CONSENT=true;samesite=strict;" + domain + path + expires;
});