refactor(analytics): add module context to all Umami events

Resolves event name collisions in the unified app (e.g. view_changed,
deck_created, search_performed) by adding a `module` property to every
tracked event via createModuleTracker. Also fixes duplicate tracking in
Planta routes (now only tracked in mutations.ts).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-02 16:35:27 +02:00
parent 779a8ba322
commit 5280cc6dc7
6 changed files with 260 additions and 224 deletions

View file

@ -28,7 +28,7 @@ import {
function trackAuth(event: string, data?: Record<string, string | number | boolean>): void {
if (typeof window !== 'undefined' && (window as any).umami?.track) {
try {
(window as any).umami.track(event, data);
(window as any).umami.track(event, { ...data, module: 'auth' });
} catch {
// Silently ignore tracking errors
}