From cf8e67c45221192bf3002e9e9587d12ac17640f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Tonh=C3=A4user?= Date: Thu, 25 Jun 2026 15:41:28 +0200 Subject: [PATCH] feat: Google Tag Manager + Consent Mode v2 + Cookie-Banner (DSGVO) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Auf allen 26 Seiten: altes GA-gtag-Snippet (G-CC4TX68365) ersetzt durch Google-Consent-Mode-v2-Default „denied" + GTM-Container GTM-T6CVBLPR (head) - GTM-noscript-iframe direkt nach - Neue custom/consent.js: selbstgebautes Consent-Banner (Akzeptieren / Nur Notwendige / Datenschutz-Link), speichert Wahl in localStorage, updated Consent Mode. Auf allen Seiten eingebunden. Voraussetzung für Google Ads; DSGVO-konform (keine Cookies vor Einwilligung). Co-Authored-By: Claude --- public/404.html | 26 ++++++-- public/blog.html | 24 +++++++ public/custom/consent.js | 62 +++++++++++++++++++ public/datenschutz.html | 26 ++++++-- public/impressum.html | 26 ++++++-- public/index.html | 26 ++++++-- public/kontakt.html | 26 ++++++-- public/leistungen.html | 26 ++++++-- public/portfolio-abiball.html | 26 ++++++-- public/portfolio-aufstiegsfeier.html | 26 ++++++-- public/portfolio-beach-soccer-cup.html | 26 ++++++-- public/portfolio-deutschland-u21.html | 26 ++++++-- public/portfolio-fc-st-pauli.html | 26 ++++++-- public/portfolio-frauen-bundesliga.html | 26 ++++++-- public/portfolio-hamburger-sv.html | 26 ++++++-- public/portfolio-hannover-96.html | 26 ++++++-- public/portfolio-nfv-pokalfinale-2026.html | 26 ++++++-- public/portfolio-omr-yes-wecancer.html | 26 ++++++-- public/portfolio-rhine-ruhr-3x3.html | 26 ++++++-- public/portfolio-rhine-ruhr-basketball.html | 26 ++++++-- .../portfolio-rhine-ruhr-beachvolleyball.html | 26 ++++++-- public/portfolio-rhine-ruhr-sport.html | 26 ++++++-- public/portfolio-sv-meppen.html | 26 ++++++-- public/portfolio-svg-lueneburg.html | 26 ++++++-- public/portfolio-yes-con-2026.html | 26 ++++++-- public/portfolio.html | 26 ++++++-- public/über-mich.html | 26 ++++++-- 27 files changed, 611 insertions(+), 125 deletions(-) create mode 100644 public/custom/consent.js diff --git a/public/404.html b/public/404.html index 691832e..e5eec34 100644 --- a/public/404.html +++ b/public/404.html @@ -5,14 +5,25 @@ Seite nicht gefunden | Leon Tonhäuser - - + + + + + + +

Blog

Hier schreibe ich bald über Shootings, Hintergründe und alles, was neben der Kamera passiert.

@@ -42,5 +65,6 @@ + diff --git a/public/custom/consent.js b/public/custom/consent.js new file mode 100644 index 0000000..843ea81 --- /dev/null +++ b/public/custom/consent.js @@ -0,0 +1,62 @@ +// 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) { + 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. + function show() { + 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 = '

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.

'; + 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(); + } +})(); \ No newline at end of file diff --git a/public/datenschutz.html b/public/datenschutz.html index ea58a1c..3b402a2 100644 --- a/public/datenschutz.html +++ b/public/datenschutz.html @@ -5,14 +5,25 @@ Datenschutz | Leon Tonhäuser - - + + + +