No need to use window.Cookies, just Cookies works.
This commit is contained in:
parent
aa3a5d3808
commit
e59dc13d4d
2 changed files with 6 additions and 6 deletions
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
if (typeof window.Cookies !== 'undefined') {
|
if (typeof Cookies !== 'undefined') {
|
||||||
const cookieconsent = document.querySelector('.cookieconsent');
|
const cookieconsent = document.querySelector('.cookieconsent');
|
||||||
|
|
||||||
if (typeof window.Cookies.get('cookieconsent') === 'undefined' && cookieconsent) {
|
if (typeof Cookies.get('cookieconsent') === 'undefined' && cookieconsent) {
|
||||||
cookieconsent.classList.add('js-cookieconsent-open');
|
cookieconsent.classList.add('js-cookieconsent-open');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -25,10 +25,10 @@
|
||||||
cookie_buttons.forEach(function (button) {
|
cookie_buttons.forEach(function (button) {
|
||||||
button.addEventListener('click', function () {
|
button.addEventListener('click', function () {
|
||||||
if (button.getAttribute('data-consent') === 'true') {
|
if (button.getAttribute('data-consent') === 'true') {
|
||||||
window.Cookies.set('cookieconsent', 'accept', cookie_options);
|
Cookies.set('cookieconsent', 'accept', cookie_options);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.Cookies.set('cookieconsent', 'decline', cookie_options);
|
Cookies.set('cookieconsent', 'decline', cookie_options);
|
||||||
}
|
}
|
||||||
cookieconsent.classList.remove('js-cookieconsent-open');
|
cookieconsent.classList.remove('js-cookieconsent-open');
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,13 +16,13 @@ _paq.push(['setTrackerUrl', matomoTrackingApiUrl]);
|
||||||
_paq.push(['setSiteId', idSite]);
|
_paq.push(['setSiteId', idSite]);
|
||||||
_paq.push(['trackPageView']);
|
_paq.push(['trackPageView']);
|
||||||
_paq.push(['enableLinkTracking']);
|
_paq.push(['enableLinkTracking']);
|
||||||
if (typeof window.Cookies !== 'undefined' && Cookies.get('cookieconsent') === 'accept') {
|
if (typeof Cookies !== 'undefined' && Cookies.get('cookieconsent') === 'accept') {
|
||||||
_paq.push(['setConsentGiven']);
|
_paq.push(['setConsentGiven']);
|
||||||
}
|
}
|
||||||
|
|
||||||
var googleAnalytics = '{{ .Site.GoogleAnalytics }}';
|
var googleAnalytics = '{{ .Site.GoogleAnalytics }}';
|
||||||
if (cookieConsent) {
|
if (cookieConsent) {
|
||||||
if (typeof window.Cookies === 'undefined' || Cookies.get('cookieconsent') !== 'accept') {
|
if (typeof Cookies === 'undefined' || Cookies.get('cookieconsent') !== 'accept') {
|
||||||
window['ga-disable-' + googleAnalytics] = true;
|
window['ga-disable-' + googleAnalytics] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue