From be151fd6f7e7860cc60bee67bab815c155e86fcd Mon Sep 17 00:00:00 2001 From: Fuwn Date: Fri, 29 May 2026 23:05:37 +0000 Subject: feat(analytics): track umami events across core actions Add a guarded track() wrapper (src/lib/analytics.ts) so programmatic events no-op instead of throwing when umami is absent (localhost), lazily loaded, or ad-blocked. Instrument the core loop (progress increment, roulette, list filter, force refresh), the auth funnel (log in/out, command palette), settings toggles/selects at the wrapper level, sync/debug/feed actions, and tool/sharing actions. --- src/lib/List/MediaRoulette.svelte | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/lib/List/MediaRoulette.svelte') diff --git a/src/lib/List/MediaRoulette.svelte b/src/lib/List/MediaRoulette.svelte index dc9a2269..64c585df 100644 --- a/src/lib/List/MediaRoulette.svelte +++ b/src/lib/List/MediaRoulette.svelte @@ -5,6 +5,7 @@ import { outboundLink } from "$lib/Media/links"; import settings from "$stores/settings"; import locale from "$stores/locale"; import { mediaTitle } from "./mediaTitle"; +import { track } from "$lib/analytics"; interface Props { media: Media[]; @@ -25,6 +26,8 @@ let currentMedia = $derived(media[displayIndex]); const startRoulette = () => { if (media.length === 0 || isSpinning) return; + track("Spin Roulette", { type }); + isSpinning = true; showResult = false; selectedIndex = Math.floor(Math.random() * media.length); @@ -131,6 +134,7 @@ const handleOverlayClick = (e: MouseEvent) => { href={outboundLink(currentMedia, type, $settings.displayOutboundLinksTo)} target="_blank" class="view-link" + data-umami-event="Roulette View Media" > {$locale({ values: { -- cgit v1.2.3