From fbf3ee008240e4984a0d1235a2b3daab09a056d1 Mon Sep 17 00:00:00 2001 From: Henjo Hoeksma Date: Wed, 15 Sep 2021 17:43:18 +0200 Subject: [PATCH 1/2] Bugfix: safari on http does not persist cookie Safari on HTTP does not persist a cookie when set to secure. --- Resources/Public/JavaScript/Main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Public/JavaScript/Main.js b/Resources/Public/JavaScript/Main.js index b07a872..9934580 100644 --- a/Resources/Public/JavaScript/Main.js +++ b/Resources/Public/JavaScript/Main.js @@ -218,7 +218,7 @@ function saveConsentToCookie(inputs, userId) { expireDate: expireDate.toUTCString() }; - var cookieParams = encodeURI(JSON.stringify(cookieData)) + "; expires=" + new Date(currentDate.getTime() + 315360000000).toUTCString() + "; path=/; " + (KD_GDPR_CC.cookieDomainName ? ('domain=' + KD_GDPR_CC.cookieDomainName + ';') : '') +" Secure;"; + var cookieParams = encodeURI(JSON.stringify(cookieData)) + "; expires=" + new Date(currentDate.getTime() + 315360000000).toUTCString() + "; path=/; " + (KD_GDPR_CC.cookieDomainName ? ('domain=' + KD_GDPR_CC.cookieDomainName + ';') : '') + (location.protocol === 'https' ? " Secure;" : ''); document.cookie = KD_GDPR_CC.cookieName + "=" + cookieParams; window.dataLayer = window.dataLayer || []; From 52ec8791e9244361f9477f043725ca7126759da4 Mon Sep 17 00:00:00 2001 From: Henjo Hoeksma Date: Tue, 21 Sep 2021 17:49:34 +0200 Subject: [PATCH 2/2] Updated protocol matcher --- Resources/Public/JavaScript/Main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Public/JavaScript/Main.js b/Resources/Public/JavaScript/Main.js index 9934580..1940ac5 100644 --- a/Resources/Public/JavaScript/Main.js +++ b/Resources/Public/JavaScript/Main.js @@ -218,7 +218,7 @@ function saveConsentToCookie(inputs, userId) { expireDate: expireDate.toUTCString() }; - var cookieParams = encodeURI(JSON.stringify(cookieData)) + "; expires=" + new Date(currentDate.getTime() + 315360000000).toUTCString() + "; path=/; " + (KD_GDPR_CC.cookieDomainName ? ('domain=' + KD_GDPR_CC.cookieDomainName + ';') : '') + (location.protocol === 'https' ? " Secure;" : ''); + var cookieParams = encodeURI(JSON.stringify(cookieData)) + "; expires=" + new Date(currentDate.getTime() + 315360000000).toUTCString() + "; path=/; " + (KD_GDPR_CC.cookieDomainName ? ('domain=' + KD_GDPR_CC.cookieDomainName + ';') : '') + (location.protocol.substring(0,5) === 'https' ? " Secure;" : ''); document.cookie = KD_GDPR_CC.cookieName + "=" + cookieParams; window.dataLayer = window.dataLayer || [];