Replace Google Analytics and cookie consent banner with Umami analytics
All checks were successful
Build and Push Docker Images / Build Backend (FastAPI) (push) Successful in 3m18s
Build and Push Docker Images / Build Frontend (Next.js) (push) Successful in 1m56s
Build and Push Docker Images / Trigger Portainer Update (push) Successful in 0s

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Tudor Sitaru
2026-02-20 15:17:00 +00:00
parent ec61e16c9d
commit 9b55320aa7

View File

@@ -11,6 +11,9 @@
<meta name="author" content="SchoolCompare"> <meta name="author" content="SchoolCompare">
<meta name="robots" content="index, follow"> <meta name="robots" content="index, follow">
<!-- Analytics -->
<script defer src="http://10.0.1.225:3000/script.js" data-website-id="d7fb0c95-bb6c-4336-8209-bd10077e50dd"></script>
<!-- Favicon --> <!-- Favicon -->
<link rel="icon" type="image/svg+xml" href="/favicon.svg"> <link rel="icon" type="image/svg+xml" href="/favicon.svg">
@@ -61,8 +64,6 @@
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""> <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin="">
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script> <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script>
<link rel="stylesheet" href="/static/styles.css"> <link rel="stylesheet" href="/static/styles.css">
<!-- Cookie Consent Banner -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/silktide/consent-manager@main/silktide-consent-manager.css">
</head> </head>
<body> <body>
<div class="noise-overlay"></div> <div class="noise-overlay"></div>
@@ -379,92 +380,6 @@
</footer> </footer>
<script src="/static/app.js"></script> <script src="/static/app.js"></script>
<!-- Google Analytics (loaded conditionally after consent) -->
<script>
var GA_MEASUREMENT_ID = null;
var analyticsConsentGiven = false;
function loadGoogleAnalytics() {
if (window.gaLoaded || !GA_MEASUREMENT_ID) return;
window.gaLoaded = true;
// Load gtag.js script
var script = document.createElement('script');
script.async = true;
script.src = 'https://www.googletagmanager.com/gtag/js?id=' + GA_MEASUREMENT_ID;
document.head.appendChild(script);
// Initialize dataLayer and gtag function
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
window.gtag = gtag;
gtag('js', new Date());
gtag('config', GA_MEASUREMENT_ID);
}
// Fetch GA ID from server config, then load GA if consent already given
fetch('/api/config')
.then(function(response) { return response.json(); })
.then(function(config) {
if (config.ga_measurement_id) {
GA_MEASUREMENT_ID = config.ga_measurement_id;
// If consent was already given before config loaded, load GA now
if (analyticsConsentGiven) {
loadGoogleAnalytics();
}
}
})
.catch(function(err) { console.warn('Failed to load config:', err); });
</script>
<!-- Cookie Consent Banner -->
<script src="https://cdn.jsdelivr.net/gh/silktide/consent-manager@main/silktide-consent-manager.js"></script>
<script>
window.silktideConsentManager.init({
consentTypes: [
{
id: 'necessary',
label: 'Necessary',
description: 'Essential cookies required for the website to function properly.',
required: true,
defaultValue: true
},
{
id: 'analytics',
label: 'Analytics',
description: 'Help us understand how visitors use our site so we can improve it.',
required: false,
defaultValue: false
}
],
text: {
title: 'Cookie Preferences',
description: 'We use cookies to improve your experience. Analytics cookies help us understand how you use the site.',
acceptAll: 'Accept All',
rejectAll: 'Reject All',
save: 'Save Preferences'
},
onConsentChange: function(consent) {
if (consent.analytics) {
analyticsConsentGiven = true;
loadGoogleAnalytics();
}
}
});
// Check existing consent state after initialization
(function() {
var manager = window.silktideConsentManager.getInstance();
if (manager) {
var analyticsConsent = manager.getConsentChoice('analytics');
if (analyticsConsent === true) {
analyticsConsentGiven = true;
loadGoogleAnalytics();
}
}
})();
</script>
</body> </body>
</html> </html>