1
0
Fork 0

Fix cookie usage detection

This commit is contained in:
Carlos Mogas da Silva 2021-05-14 01:20:07 +01:00
parent 0e5c12ba90
commit 881671fbfe

View file

@ -14,12 +14,11 @@ function dismissPopup() {
}
function updateCookieConsent() {
t=Matomo.getTracker(matomoHostURL, matomoSiteId);
when = t.getRememberedCookieConsent();
t=Matomo.getAsyncTracker();
button = document.getElementById("cookiesaction");
text = button.parentNode.getElementsByTagName('span')[0]
if (when == 0) {
if (!t.areCookiesEnabled()) {
text.innerHTML = "You haven't allowed cookies to be used"
button.innerHTML = "Allow"
button.style.visibility = ""
@ -33,13 +32,13 @@ function updateCookieConsent() {
}
function stopCookieConsent() {
t=Matomo.getTracker(matomoHostURL, matomoSiteId);
t=Matomo.getAsyncTracker();
t.forgetCookieConsentGiven();
updateCookieConsent();
}
function startCookieConsent() {
t=Matomo.getTracker(matomoHostURL, matomoSiteId);
t=Matomo.getAsyncTracker();
t.rememberCookieConsentGiven();
updateCookieConsent();
}