From 86f81cf9dd26dfcb6632c30943f6137c958bd2aa Mon Sep 17 00:00:00 2001 From: George Powell Date: Thu, 5 Feb 2026 17:46:14 -0500 Subject: [PATCH] Use user ID for umami identify when authenticated --- src/routes/+page.svelte | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index bb3cacf..c86486b 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -174,7 +174,8 @@ if (!browser) return; anonymousId = getOrCreateAnonymousId(); if ((window as any).umami) { - (window as any).umami.identify(anonymousId); + // Use user id if logged in, otherwise use anonymous id + (window as any).umami.identify(user ? user.id : anonymousId); } const statsKey = `bibdle-stats-submitted-${dailyVerse.date}`; statsSubmitted = localStorage.getItem(statsKey) === "true"; @@ -264,7 +265,7 @@ (async () => { try { const response = await fetch( - `/api/submit-completion?anonymousId=${anonymousId}&date=${dailyVerse.date}`, + `/api/submit-completion?anonymousId=${user ? user.id : anonymousId}&date=${dailyVerse.date}`, ); const result = await response.json(); console.log("Stats response:", result); @@ -294,7 +295,7 @@ async function submitStats() { try { const payload = { - anonymousId, + anonymousId: user ? user.id : anonymousId, date: dailyVerse.date, guessCount: guesses.length, }; @@ -455,7 +456,7 @@