aboutsummaryrefslogtreecommitdiff
path: root/src/routes
diff options
context:
space:
mode:
authorFuwn <[email protected]>2026-05-29 23:05:37 +0000
committerFuwn <[email protected]>2026-05-29 23:05:37 +0000
commitbe151fd6f7e7860cc60bee67bab815c155e86fcd (patch)
tree47dcfe80450479efe722f4b59c58f934d07f3618 /src/routes
parentfeat(lists): animate list-title count with NumberTicker (diff)
downloaddue.moe-be151fd6f7e7860cc60bee67bab815c155e86fcd.tar.xz
due.moe-be151fd6f7e7860cc60bee67bab815c155e86fcd.zip
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.
Diffstat (limited to 'src/routes')
-rw-r--r--src/routes/+layout.svelte5
-rw-r--r--src/routes/user/[user]/badges/+page.svelte9
2 files changed, 12 insertions, 2 deletions
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index b1f9fc87..a35fee29 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -32,6 +32,7 @@ import Message from "$lib/Loading/Message.svelte";
import { requestNotifications } from "$lib/Utility/notifications";
import { database as userDatabase } from "$lib/Database/IDB/user";
import CommandPalette from "$lib/CommandPalette/CommandPalette.svelte";
+import { track } from "$lib/analytics";
import { defaultActions } from "$lib/CommandPalette/actions";
import { authActions } from "$lib/CommandPalette/authActions";
import { syncActions } from "$lib/CommandPalette/syncActions";
@@ -402,6 +403,8 @@ $: {
url: '#',
preventDefault: true,
onClick: async () => {
+ track('Log Out', { source: 'header' });
+
await localforage.removeItem('identity');
await localforage.removeItem('commit');
@@ -424,6 +427,8 @@ $: {
class="header-item"
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: 'header' });
+
await localforage.setItem(
'redirect',
window.location.origin + window.location.pathname + window.location.search
diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte
index de55b456..77770498 100644
--- a/src/routes/user/[user]/badges/+page.svelte
+++ b/src/routes/user/[user]/badges/+page.svelte
@@ -861,7 +861,7 @@ const shadowHideBadge = () => {
/>
</span>
</Dropdown>
- <button class="button-lined" onclick={submitBadge}
+ <button class="button-lined" onclick={submitBadge} data-umami-event="Submit Badge"
>{selectedBadge
? $locale().user.badges.editMode.update
: $locale().user.badges.editMode.add}</button
@@ -987,7 +987,12 @@ const shadowHideBadge = () => {
>
{$locale().user.badges.importMode.cancel}
</button>
- <button onclick={() => parsePost()} class="button-lined" style="float: right;">
+ <button
+ onclick={() => parsePost()}
+ class="button-lined"
+ style="float: right;"
+ data-umami-event="Parse Badge Post"
+ >
{$locale().user.badges.importMode.fetch}
</button>