Files
movie-advisor/lib/analytics/events.ts
T
nerandClaude Opus 5 66776c582f refactor(analytics): send titles alongside ids, drop comments
Bare ids are unreadable in the dashboard, so every event that points at a
show or a person now carries its title or name. Ids stay for disambiguation,
since titles collide across remakes.

- ShowRef gains showTitle, so show_viewed, library_toggled, torrents_searched,
  torrent_selected, playback_started and playback_failed all report it
- person_viewed sends personName
- random_shuffled sends the title of the movie scrolled to
- torrent_selected sends the torrent title next to the show title
- subtitles_selected sends the track label, such as English, rather than the
  internal track value

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 12:44:38 +03:00

33 lines
1.1 KiB
TypeScript

type ShowRef = { showId: Show['id']; showType: Show['type']; showTitle: string };
export type ListName = 'popular' | 'top' | 'search' | 'favorite' | 'watchlist' | 'random';
export type AnalyticsEvents = {
show_viewed: ShowRef & { surface: 'page' | 'modal' };
person_viewed: { personId: string; personName: string };
list_loaded_more: { list: ListName; page: number };
random_shuffled: { index: number; showTitle: string };
search_performed: { query: string; showType: Show['type']; results: number };
gallery_tab_changed: { tab: string };
library_toggled: ShowRef & { list: 'favorite' | 'watchlist'; value: boolean };
auth_completed: void;
auth_signed_out: void;
torrents_searched: ShowRef & { provider: string; results: number };
torrent_selected: ShowRef & {
provider: string;
torrentTitle: string;
seeders: number;
quality?: string;
source?: string;
codec?: string;
};
playback_started: ShowRef;
playback_failed: ShowRef & { reason: string };
subtitles_selected: { language: string };
};
export type AnalyticsEvent = keyof AnalyticsEvents;