function getCookie(name) { const m = document.cookie.match(new RegExp('(?:^|; )' + name.replace(/[$()*+.?[\\\]^{|}]/g,'\\$&') + '=([^;]*)')); return m ? decodeURIComponent(m[1]) : null; } // Matomo commonly uses these cookies when using consent APIs: function getMatomoConsentState() { // Some Matomo docs mention cookie "consent" :contentReference[oaicite:2]{index=2} if (getCookie("consent")) return "accepted"; // Common in real deployments / issues & forum discussions :contentReference[oaicite:3]{index=3} if (getCookie("mtm_consent") || getCookie("mtm_cookie_consent")) return "accepted"; if (getCookie("mtm_consent_removed") || getCookie("mtm_cookie_consent_removed")) return "rejected"; return null; // no choice } (function () { /********************************************************** * CONFIG — CHANGE THESE **********************************************************/ const MATOMO_URL = "https://matomo.klassik-stiftung.de/"; // must end with / const MATOMO_SITE_ID = "40"; const CONSENT_KEY = "matomo_consent_choice"; // accepted | rejected | null /********************************************************** * MATOMO SETUP (Consent Required) **********************************************************/ window._paq = window._paq || []; // Require consent BEFORE tracking is allowed _paq.push(["requireConsent"]); // Apply saved consent choice const saved = getMatomoConsentState(); if (saved === "accepted") { _paq.push(["rememberConsentGiven"]); } else if (saved === "rejected") { _paq.push(["forgetConsentGiven"]); } // Load Matomo script function loadMatomo() { _paq.push(["setTrackerUrl", MATOMO_URL + "matomo.php"]); _paq.push(["setSiteId", MATOMO_SITE_ID]); const g = document.createElement("script"); g.async = true; g.src = MATOMO_URL + "matomo.js"; document.head.appendChild(g); } loadMatomo(); /********************************************************** * BANNER HTML (Injected dynamically) **********************************************************/ function injectBanner() { // Create banner div const old = document.getElementById("matomo-consent-banner"); if (old) old.remove(); const banner = document.createElement("div"); banner.id = "matomo-consent-banner"; const choice = getMatomoConsentState() let statusText = "⚠️ No choice made yet."; if (choice === "accepted") statusText = "✅ Matomonachverfolgung ist zur Zeit EIN."; if (choice === "rejected") statusText = "❌ Matomonachverfolgung ist zur Zeit AUS."; banner.innerHTML = `
Auf dieser Seite benutzen wir Matomo zur Webanalyse. Es werden sonst ausschließlich technische Cookies genutzt. Für eingebettete Inhalte wird jeweils explizit eine Einwilligung erbeten. Es gilt diese Datenschutzbestimmung.
Status: ${statusText}