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>
This commit is contained in:
nerandClaude Opus 5 committed 2026-08-14 12:44:38 +03:00
1 parent 01753d4eb6
commit 66776c582f
13 files changed
+39 -43

No files matched your search

+1 -8
View File
@@ -1,14 +1,7 @@
import { useEffect, useRef } from 'react';
// Stands in for TypeScript 5.4's NoInfer. Without it the payload widens literal unions such as
// `'page' | 'modal'` to `string` instead of being checked against the emitter's type.
type NoInfer<Type> = [Type][Type extends unknown ? 0 : never];
/**
* Fires an emitter once per distinct `key`, skipping while it is nullish. Keeps view style
* events (a show opened, a search resolved) to a single line at the call site instead of an
* effect plus a ref in every component that needs one.
*/
const useTrackOnce = <Properties>(
emit: (properties: Properties) => void,
key: string | number | null | undefined,
@@ -24,7 +17,7 @@ const useTrackOnce = <Properties>(
sentRef.current = key;
emit(payloadRef.current());
emit(payloadRef.current() as Properties);
}, [emit, key]);
};