From be151fd6f7e7860cc60bee67bab815c155e86fcd Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.net>
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/LandingHero.svelte | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'src/lib/LandingHero.svelte')

diff --git a/src/lib/LandingHero.svelte b/src/lib/LandingHero.svelte
index bec9d1f4..ed019274 100644
--- a/src/lib/LandingHero.svelte
+++ b/src/lib/LandingHero.svelte
@@ -2,6 +2,7 @@
 import { env } from "$env/dynamic/public";
 import localforage from "localforage";
 import lenis from "$stores/lenis";
+import { track } from "$lib/analytics";
 
 let heroSection = $state<HTMLElement>();
 
@@ -35,6 +36,8 @@ const scrollPastHero = () => {
       class="cta"
       href={`https://anilist.co/api/v2/oauth/authorize?client_id=${env.PUBLIC_ANILIST_CLIENT_ID}&redirect_uri=${env.PUBLIC_ANILIST_REDIRECT_URI}&response_type=code`}
       onclick={async () => {
+        track('Log In', { source: 'landing' });
+
         await localforage.setItem(
           'redirect',
           window.location.origin + window.location.pathname + window.location.search
-- 
cgit v1.2.3

