Use Umami instead of Google Analytics
This commit is contained in:
parent
ac68de0a26
commit
37921c6cce
|
|
@ -1,82 +0,0 @@
|
|||
---
|
||||
/**
|
||||
* Privacy notice banner component.
|
||||
* Displays a GDPR-compliant consent banner at the bottom of the page.
|
||||
* Manages user consent for analytics via localStorage.
|
||||
*
|
||||
* Note: Analytics loading is handled separately in Layout.astro to avoid
|
||||
* ad blockers blocking this script due to analytics-related keywords.
|
||||
*
|
||||
* Element IDs use generic names to avoid ad blocker filter lists that
|
||||
* target common patterns like "cookie-banner" or "consent-notice".
|
||||
*/
|
||||
---
|
||||
|
||||
<div
|
||||
id="priv-notice"
|
||||
class="fixed bottom-0 left-0 right-0 z-50 hidden"
|
||||
role="dialog"
|
||||
aria-labelledby="pn-title"
|
||||
aria-describedby="pn-desc"
|
||||
>
|
||||
<div class="bg-base-200 border-t border-base-300 p-4 shadow-lg">
|
||||
<div class="container mx-auto max-w-4xl">
|
||||
<div class="flex flex-col sm:flex-row items-start sm:items-center gap-4">
|
||||
<div class="flex-1">
|
||||
<h2 id="pn-title" class="font-semibold mb-1">Privacy Notice</h2>
|
||||
<p id="pn-desc" class="text-sm text-base-content/80">
|
||||
We use analytics to understand how visitors use this site.
|
||||
<a href="/privacy/" class="link link-primary">Learn more</a>
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex gap-2 flex-shrink-0">
|
||||
<button
|
||||
id="pn-decline"
|
||||
class="btn btn-sm btn-ghost"
|
||||
type="button"
|
||||
>
|
||||
Decline
|
||||
</button>
|
||||
<button
|
||||
id="pn-accept"
|
||||
class="btn btn-sm btn-primary"
|
||||
type="button"
|
||||
>
|
||||
Accept
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script is:inline>
|
||||
(function() {
|
||||
var CONSENT_KEY = 'priv-notice';
|
||||
var banner = document.getElementById('priv-notice');
|
||||
var acceptBtn = document.getElementById('pn-accept');
|
||||
var declineBtn = document.getElementById('pn-decline');
|
||||
|
||||
function setConsent(granted) {
|
||||
localStorage.setItem(CONSENT_KEY, granted ? 'granted' : 'denied');
|
||||
banner.classList.add('hidden');
|
||||
if (granted) {
|
||||
window.dispatchEvent(new CustomEvent('consent-granted'));
|
||||
}
|
||||
}
|
||||
|
||||
function checkConsent() {
|
||||
var consent = localStorage.getItem(CONSENT_KEY);
|
||||
if (consent === 'granted') {
|
||||
window.dispatchEvent(new CustomEvent('consent-granted'));
|
||||
} else if (consent === null) {
|
||||
banner.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
acceptBtn.addEventListener('click', function() { setConsent(true); });
|
||||
declineBtn.addEventListener('click', function() { setConsent(false); });
|
||||
|
||||
checkConsent();
|
||||
})();
|
||||
</script>
|
||||
|
|
@ -2,7 +2,6 @@
|
|||
import "../styles/global.css";
|
||||
import Navbar from "../components/Navbar.astro";
|
||||
import Footer from "../components/Footer.astro";
|
||||
import CookieBanner from "../components/CookieBanner.astro";
|
||||
import logo from "../assets/logo.svg";
|
||||
|
||||
import { SEO } from "astro-seo";
|
||||
|
|
@ -82,22 +81,8 @@ const seoConfig = {
|
|||
</main>
|
||||
|
||||
<Footer />
|
||||
<CookieBanner />
|
||||
|
||||
<!-- Analytics loader (separate script to avoid ad blockers blocking the consent banner) -->
|
||||
<script is:inline>
|
||||
window.addEventListener('consent-granted', function() {
|
||||
if (document.getElementById('ga-script')) return;
|
||||
var s = document.createElement('script');
|
||||
s.id = 'ga-script';
|
||||
s.async = true;
|
||||
s.src = 'https://www.googletagmanager.com/gtag/js?id=G-7308Y1HGM9';
|
||||
document.head.appendChild(s);
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() { dataLayer.push(arguments); }
|
||||
gtag('js', new Date());
|
||||
gtag('config', 'G-7308Y1HGM9');
|
||||
});
|
||||
</script>
|
||||
<!-- Umami Analytics -->
|
||||
<script defer src="https://cloud.umami.is/script.js" data-website-id="d7c69d06-32a6-4e74-94ec-2520da5e3450"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import Layout from '../layouts/Layout.astro';
|
|||
<h2>Information We Collect</h2>
|
||||
<h3>Analytics Data</h3>
|
||||
<p>
|
||||
With your consent, we use Google Analytics to collect anonymous usage data to help us understand
|
||||
We use Umami, a privacy-focused analytics service, to collect anonymous usage data to help us understand
|
||||
how visitors interact with our website. This includes:
|
||||
</p>
|
||||
<ul>
|
||||
|
|
@ -26,9 +26,8 @@ import Layout from '../layouts/Layout.astro';
|
|||
<li>Approximate geographic location (country/city level)</li>
|
||||
</ul>
|
||||
<p>
|
||||
This data is aggregated and does not personally identify you. Google Analytics uses cookies
|
||||
to collect this information. You can opt out of analytics tracking by declining cookies when
|
||||
prompted.
|
||||
Umami does not use cookies, does not collect personal data, and does not track users across websites.
|
||||
All data is aggregated and anonymous. No consent banner is required as no personal data is collected.
|
||||
</p>
|
||||
|
||||
<h3>Local Storage</h3>
|
||||
|
|
@ -36,7 +35,6 @@ import Layout from '../layouts/Layout.astro';
|
|||
We use your browser's local storage to remember:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Your cookie consent preference</li>
|
||||
<li>Your theme preference (light/dark mode)</li>
|
||||
</ul>
|
||||
<p>
|
||||
|
|
@ -59,9 +57,9 @@ import Layout from '../layouts/Layout.astro';
|
|||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<strong>Google Analytics</strong> - For website analytics.
|
||||
<a href="https://policies.google.com/privacy" target="_blank" rel="noopener noreferrer" class="link link-primary">
|
||||
Google's Privacy Policy
|
||||
<strong>Umami Analytics</strong> - For privacy-friendly website analytics.
|
||||
<a href="https://umami.is/privacy" target="_blank" rel="noopener noreferrer" class="link link-primary">
|
||||
Umami's Privacy Policy
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
|
@ -72,17 +70,10 @@ import Layout from '../layouts/Layout.astro';
|
|||
<h2>Your Rights</h2>
|
||||
<p>You have the right to:</p>
|
||||
<ul>
|
||||
<li>Decline analytics cookies when visiting our website</li>
|
||||
<li>Clear your browser's cookies and local storage at any time</li>
|
||||
<li>Use browser extensions to block tracking scripts</li>
|
||||
<li>Clear your browser's local storage at any time</li>
|
||||
<li>Use browser extensions to block analytics scripts</li>
|
||||
</ul>
|
||||
|
||||
<h2>Managing Your Consent</h2>
|
||||
<p>
|
||||
You can change your cookie preferences at any time by clearing your browser's local storage
|
||||
for this website. The consent banner will appear again on your next visit.
|
||||
</p>
|
||||
|
||||
<h2>Contact</h2>
|
||||
<p>
|
||||
If you have questions about this privacy policy, please contact us at
|
||||
|
|
|
|||
Loading…
Reference in New Issue