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:
1 parent
01753d4eb6
commit
66776c582f
13 files changed
+39
-43
No files matched your search
+4
-2
@@ -32,9 +32,11 @@ const CaptionsMenu = () => {
|
||||
label: track.label,
|
||||
value: track.value,
|
||||
onSelect: (value) => {
|
||||
analytics.subtitlesSelected({ language: value });
|
||||
const option = live.current.find((option) => option.value === value) ?? track;
|
||||
|
||||
return (live.current.find((option) => option.value === value) ?? track).select();
|
||||
analytics.subtitlesSelected({ language: option.label });
|
||||
|
||||
return option.select();
|
||||
}
|
||||
}))}
|
||||
>
|
||||
|
||||
@@ -92,6 +92,7 @@ const Player: FC<Props> = ({ magnet, playlist, subtitles, show, episodes, onStre
|
||||
useTrackOnce(analytics.playbackFailed, error && show ? `${magnet}:${error}` : undefined, () => ({
|
||||
showId: show!.id,
|
||||
showType: show!.type,
|
||||
showTitle: show!.title,
|
||||
reason: error!
|
||||
}));
|
||||
|
||||
@@ -126,7 +127,7 @@ const Player: FC<Props> = ({ magnet, playlist, subtitles, show, episodes, onStre
|
||||
setCanPlay(true);
|
||||
if (show && startedRef.current !== magnet) {
|
||||
startedRef.current = magnet;
|
||||
analytics.playbackStarted({ showId: show.id, showType: show.type });
|
||||
analytics.playbackStarted({ showId: show.id, showType: show.type, showTitle: show.title });
|
||||
}
|
||||
if (resumeTime.current) {
|
||||
player.current!.currentTime = resumeTime.current;
|
||||
|
||||
+4
@@ -66,7 +66,11 @@ const Actions: FC<Props> = ({ torrent, title, provider, show }) => {
|
||||
|
||||
const pinPlayed = () => {
|
||||
analytics.torrentSelected({
|
||||
showId: show.id,
|
||||
showType: show.type,
|
||||
showTitle: show.title,
|
||||
provider,
|
||||
torrentTitle: torrent.title,
|
||||
seeders: torrent.seeders,
|
||||
quality: torrent.quality,
|
||||
source: torrent.source,
|
||||
|
||||
@@ -52,7 +52,7 @@ const showTorrentsModal = create(({ onResolve, ...show }: Props) => {
|
||||
|
||||
const isSeries = show.type === 'tv';
|
||||
|
||||
const tracked = { id: show.id, type: show.type };
|
||||
const tracked = { id: show.id, type: show.type, title: show.title };
|
||||
|
||||
const yts = useTorrents({
|
||||
query: isSeries ? '' : show.title,
|
||||
|
||||
@@ -16,7 +16,7 @@ const useTorrents = ({
|
||||
query: string;
|
||||
sort: Sort;
|
||||
imdbID: string;
|
||||
show: { id: Show['id']; type: Show['type'] };
|
||||
show: { id: Show['id']; type: Show['type']; title: Show['title'] };
|
||||
queryFn: (params: { query: string; sort: Sort; imdbID: string }) => Promise<Torrent[]>;
|
||||
}) => {
|
||||
const result = useQuery({
|
||||
@@ -28,6 +28,7 @@ const useTorrents = ({
|
||||
useTrackOnce(analytics.torrentsSearched, result.data ? `${key}:${query}` : undefined, () => ({
|
||||
showId: show.id,
|
||||
showType: show.type,
|
||||
showTitle: show.title,
|
||||
provider: key,
|
||||
results: result.data?.length ?? 0
|
||||
}));
|
||||
|
||||
Reference in new issue
Block a user