cookie longevity, no reload, consistent with topdomain

This commit is contained in:
sakrecoer 2020-11-24 19:57:28 +01:00
parent 524fafdd13
commit 1c96e9629d
2 changed files with 7 additions and 7 deletions

View file

@ -19,7 +19,7 @@
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
expires = "; expires=" + date.toUTCString(); expires = "; expires=" + date.toUTCString();
} }
document.cookie = name + "=" + value + expires + "; path=/;SameSite=Strict"; document.cookie = name + "=" + value + "; domain=.{{ site.publisher.domain }}" + expires + "; path=/;SameSite=Strict";
} }
function readCookie(name) { function readCookie(name) {
var nameEQ = name + "="; var nameEQ = name + "=";
@ -49,23 +49,23 @@
{% include matomo.js %} {% include matomo.js %}
} }
document.getElementById('cookie-notice-accept').addEventListener("click", function () { document.getElementById('cookie-notice-accept').addEventListener("click", function () {
createCookie('cookie-notice-dismissed', 'wantCookies', 90); createCookie('cookie-notice-dismissed', 'wantCookies', 365);
document.getElementById('cookie-notice').style.display = 'none'; document.getElementById('cookie-notice').style.display = 'none';
_paq.push(['trackEvent', 'Consent', 'wantCookie']); _paq.push(['trackEvent', 'Consent', 'wantCookie']);
location.reload();
}); });
document.getElementById('cookie-notice-decline').addEventListener("click", function () { document.getElementById('cookie-notice-decline').addEventListener("click", function () {
createCookie('cookie-notice-dismissed', 'dontWantCookies', 90); createCookie('cookie-notice-dismissed', 'dontWantCookies', 365);
document.getElementById('cookie-notice').style.display = 'none'; document.getElementById('cookie-notice').style.display = 'none';
_paq.push(['trackEvent', 'Consent', 'dontWantCookie']); _paq.push(['trackEvent', 'Consent', 'dontWantCookie']);
location.reload();
}); });
// document.getElementById('cookie-notice-gimme').addEventListener("click", function () { // document.getElementById('cookie-notice-gimme').addEventListener("click", function () {
// createCookie('cookie-notice-dismissed', 'wantCookies', 31); // createCookie('cookie-notice-dismissed', 'wantCookies', 31);
// document.getElementById('cookie-notice').style.display = 'none'; // document.getElementById('cookie-notice').style.display = 'none';
// location.reload(); //
// }); // });

View file

@ -35,7 +35,7 @@ This one is set by us. It is only placed if you dismiss the cookie-banner by eit
**Visitor preferences cookies** are: **Visitor preferences cookies** are:
**Name**\: cookie-notice-dissmissed<br>**Services**\: Cookie consent kit<br>**Purpose**\: Stores your cookie preferences (so you will not be asked again) This cookie is only placed if you accept or decline to help improve our marketing via the cookie-banner buttons.<br>**Cookie type and duration:** First-party session cookie deleted after 90 days **Name**\: cookie-notice-dissmissed<br>**Services**\: Cookie consent kit<br>**Purpose**\: Stores your cookie preferences (so you will not be asked again) This cookie is only placed if you accept or decline to help improve our marketing via the cookie-banner buttons.<br>**Cookie type and duration:** First-party session cookie deleted after 12 months.
### 2\. Analytics cookies ### 2\. Analytics cookies