refactor(analytics): centralize Umami tracking via env vars and shared utility

Move Umami analytics from hardcoded script tags in app.html to
server-side injection via hooks.server.ts. Website IDs are now
managed centrally in .env.development and distributed via
generate-env.mjs as PUBLIC_UMAMI_WEBSITE_ID.

- Add @manacore/shared-utils/analytics-server with injectUmamiAnalytics()
- Add UMAMI_WEBSITE_ID_* for all 17 web apps to .env.development
- Add PUBLIC_UMAMI_WEBSITE_ID mapping in generate-env.mjs for all web apps
- Update 10 existing hooks.server.ts to use shared utility
- Create 7 new hooks.server.ts (picture, planta, presi, photos, clock,
  questions, manadeck)
- Remove hardcoded Umami scripts from all 17 app.html files
- Add missing Umami tracking to Mukke and Questions
- Add shared-utils dependency to 6 web apps that lacked it
- Update ANALYTICS.md with architecture docs and "add new app" guide

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-03-22 18:27:31 +01:00
parent 87516bb58a
commit e01b740dba
44 changed files with 319 additions and 52 deletions

View file

@ -53,6 +53,7 @@
"@manacore/shared-theme": "workspace:*",
"@manacore/shared-theme-ui": "workspace:*",
"@manacore/shared-ui": "workspace:*",
"@manacore/shared-utils": "workspace:*",
"svelte-i18n": "^4.0.1"
},
"type": "module"

View file

@ -11,11 +11,7 @@
<meta property="og:description" content="Dein sicherer Cloud-Speicher für Dateien, Ordner und mehr." />
<meta property="og:site_name" content="Storage" />
<title>Storage - Cloud Drive</title>
<link rel="preconnect" href="https://stats.mana.how" />
<link rel="dns-prefetch" href="https://stats.mana.how" />
%sveltekit.head%
<!-- Umami Analytics -->
<script defer src="https://stats.mana.how/script.js" data-website-id="392ff51d-11f1-4f0c-9d55-6af1402a3ee6"></script>
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>