// Cookie-/Consent-Banner (Google Consent Mode v2). // Selbstgebaute, DSGVO-konforme Einwilligung. Defaults stehen auf „denied" (im head), // nach Nutzerwahl update per gtag('consent','update',…). Wahl landet in localStorage. (function () { 'use strict'; var KEY = 'lt_consent_v1'; function update(granted) { // GTM erst nach Einwilligung laden – vorher keine Verbindung zu Google. if (granted && typeof window.ltLadeGtm === 'function') window.ltLadeGtm(); if (typeof gtag !== 'function') return; var v = granted ? 'granted' : 'denied'; gtag('consent', 'update', { 'ad_storage': v, 'ad_user_data': v, 'ad_personalization': v, 'analytics_storage': v }); } var saved = null; try { saved = localStorage.getItem(KEY); } catch (e) {} if (saved === 'all') { update(true); return; } if (saved === 'none') { update(false); return; } // Keine Entscheidung gespeichert → Banner einblenden. // Englische Sprachversion (lang="en") bekommt englische Texte, // der Datenschutz-Link zeigt dann aus /en/ heraus auf ../datenschutz. function show() { var EN = document.documentElement.lang === 'en'; var texte = EN ? { hinweis: 'This site uses Google Analytics & Google Ads to measure usage and show you more relevant advertising. Clicking "Accept all" consents to the processing. You can choose "Necessary only". See the privacy policy.', akzeptieren: 'Accept all', ablehnen: 'Necessary only' } : { hinweis: 'Diese Seite nutzt Google Analytics & Google Ads, um die Nutzung zu messen und dir relevantere Werbung zu zeigen. Mit „Alle akzeptieren" stimmst du der Verarbeitung zu. Du kannst „Nur Notwendige" wählen. Mehr in der Datenschutzerklärung.', akzeptieren: 'Alle akzeptieren', ablehnen: 'Nur Notwendige' }; var style = document.createElement('style'); style.textContent = [ '#lt-consent{position:fixed;left:0;right:0;bottom:0;z-index:9999;background:#fff;color:#111;', 'box-shadow:0 -4px 24px rgba(0,0,0,.12);padding:18px 20px;font:inherit;font-size:14px;line-height:1.5}', '#lt-consent .lt-inner{max-width:1080px;margin:0 auto;display:flex;gap:16px;align-items:center;flex-wrap:wrap}', '#lt-consent p{margin:0;flex:1 1 320px}', '#lt-consent a{color:#111;text-decoration:underline}', '#lt-consent .lt-btns{display:flex;gap:10px;flex-wrap:wrap}', '#lt-consent button{font:inherit;font-weight:600;border-radius:10px;padding:10px 18px;cursor:pointer;border:1px solid #ddd;background:#fff;color:#111}', '#lt-consent button.lt-accept{background:#111;color:#fff;border-color:#111}' ].join(''); document.head.appendChild(style); var b = document.createElement('div'); b.id = 'lt-consent'; b.innerHTML = '

' + texte.hinweis + '

'; document.body.appendChild(b); function close() { b.remove(); style.remove(); } b.querySelector('.lt-accept').addEventListener('click', function () { try { localStorage.setItem(KEY, 'all'); } catch (e) {} update(true); close(); }); b.querySelector('.lt-decline').addEventListener('click', function () { try { localStorage.setItem(KEY, 'none'); } catch (e) {} update(false); close(); }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', show); } else { show(); } })();