feat(analytics): track significant user events via Umami #57

Merged
eliott merged 1 commit from feat/tracking into develop 2026-05-16 10:19:49 +02:00
Owner

Summary

  • Adds a small AnalyticsService wrapper around `window.umami.track()` that no-ops when Umami is blocked / missing / SSR.
  • Wires events into the meaningful funnels: auth (signup, login by method, logout, 2FA), CRUD creation (shoots, frames, plus all settings entities via BaseFormDrawer), data movement (export / import with counts), theme changes (only user-initiated, via ThemeService.set), and changelog views.
  • Includes the Umami script tag in `index.html` from the prior setup step.
  • Bumps `rollnote-front` 7.1.1 -> 7.2.0 (minor: new feature). Paired with a v7.2.0 changelog entry in rollnote-api (separate PR).

Events

Event Properties
`signup` -
`login` method (password / passkey / 2fa)
`logout` -
`shoot_created` -
`frame_created` hasLocation, flash
`entity_created` entity (film, camera, lens, filter, weather, iso, film_format, folder)
`data_exported` -
`data_imported` accountTarget, mergeStrategy, wipe, shoots, frames
`theme_changed` mode
`changelog_viewed` -

Design notes

  • One shared `entity_created` event with an `entity` property rather than 8 distinct events: cleaner dashboard, and `BaseFormDrawer` already centralized this so each subclass just adds a one-line `entityType` field.
  • Theme tracking sits in `ThemeService.set()`, not the toggle component: any future entry point is covered automatically, and OS-level theme changes (which bypass `.set()`) don't fire false events.
  • 2FA login is tracked as a distinct `method='2fa'` so adoption is visible separately from plain password.
  • No tracking on updates / deletes (low signal, high noise).
  • AnalyticsService swallows all errors and never throws into the app.

Test plan

  • `pnpm test` (currently 702 pass)
  • `pnpm build` clean
  • Sign up + log in -> events appear in Umami dashboard
  • Create a shoot, then a frame -> `shoot_created` and `frame_created` appear
  • Add a film / camera / lens -> `entity_created` with correct `entity` property
  • Toggle theme -> `theme_changed` once per toggle
  • Export data -> `data_exported`; import a fixture -> `data_imported` with counts
  • Verify no console errors when Umami is blocked by uBlock
## Summary - Adds a small AnalyticsService wrapper around \`window.umami.track()\` that no-ops when Umami is blocked / missing / SSR. - Wires events into the meaningful funnels: auth (signup, login by method, logout, 2FA), CRUD creation (shoots, frames, plus all settings entities via BaseFormDrawer), data movement (export / import with counts), theme changes (only user-initiated, via ThemeService.set), and changelog views. - Includes the Umami script tag in \`index.html\` from the prior setup step. - Bumps \`rollnote-front\` 7.1.1 -> 7.2.0 (minor: new feature). Paired with a v7.2.0 changelog entry in rollnote-api (separate PR). ## Events | Event | Properties | |---|---| | \`signup\` | - | | \`login\` | method (password / passkey / 2fa) | | \`logout\` | - | | \`shoot_created\` | - | | \`frame_created\` | hasLocation, flash | | \`entity_created\` | entity (film, camera, lens, filter, weather, iso, film_format, folder) | | \`data_exported\` | - | | \`data_imported\` | accountTarget, mergeStrategy, wipe, shoots, frames | | \`theme_changed\` | mode | | \`changelog_viewed\` | - | ## Design notes - One shared \`entity_created\` event with an \`entity\` property rather than 8 distinct events: cleaner dashboard, and \`BaseFormDrawer\` already centralized this so each subclass just adds a one-line \`entityType\` field. - Theme tracking sits in \`ThemeService.set()\`, not the toggle component: any future entry point is covered automatically, and OS-level theme changes (which bypass \`.set()\`) don't fire false events. - 2FA login is tracked as a distinct \`method='2fa'\` so adoption is visible separately from plain password. - No tracking on updates / deletes (low signal, high noise). - AnalyticsService swallows all errors and never throws into the app. ## Test plan - [ ] \`pnpm test\` (currently 702 pass) - [ ] \`pnpm build\` clean - [ ] Sign up + log in -> events appear in Umami dashboard - [ ] Create a shoot, then a frame -> \`shoot_created\` and \`frame_created\` appear - [ ] Add a film / camera / lens -> \`entity_created\` with correct \`entity\` property - [ ] Toggle theme -> \`theme_changed\` once per toggle - [ ] Export data -> \`data_exported\`; import a fixture -> \`data_imported\` with counts - [ ] Verify no console errors when Umami is blocked by uBlock
feat(analytics): track significant user events via Umami
All checks were successful
tests / test (pull_request) Successful in 2m37s
a6fa21bcd5
Add AnalyticsService wrapper around window.umami.track() that no-ops if
Umami is blocked, missing, or running under SSR. Wire it into the meaningful
funnels: auth (signup, login by method, logout), CRUD creation (shoots,
frames, plus all settings entities via BaseFormDrawer), data movement
(export, import), theme changes, and changelog views.

Theme tracking lives inside ThemeService.set() so system auto-changes (which
bypass set) don't fire false events, and any future entry point is covered
for free. Entity creations go through one shared 'entity_created' event with
an 'entity' property, keeping the dashboard tidy and the per-drawer change
to a single one-line field.

Also includes the Umami script tag in index.html that was staged from the
prior setup step.

Bump rollnote-front 7.1.1 -> 7.2.0 (minor: new feature).
eliott merged commit f44d7bd1a9 into develop 2026-05-16 10:19:49 +02:00
eliott deleted branch feat/tracking 2026-05-16 10:19:49 +02:00
Sign in to join this conversation.
No reviewers
No labels
run-ci
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
RollNote/rollnote-front!57
No description provided.