0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00

feat: Add screen name info to recordings (#13931)

This commit is contained in:
Ben White 2023-01-26 16:08:20 +01:00 committed by GitHub
parent 57f06ae479
commit ce2b675270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -204,6 +204,14 @@ export function PlayerMeta(props: SessionRecordingPlayerLogicProps): JSX.Element
</span>
</span>
)}
{lastPageviewEvent?.properties?.['$screen_name'] && (
<span className="flex items-center gap-2 truncate">
<span>·</span>
<span className="flex items-center gap-1 truncate">
{lastPageviewEvent?.properties['$screen_name']}
</span>
</span>
)}
</>
)}
<div className={clsx('flex-1', isSmallPlayer ? 'min-w-4' : 'min-w-20')} />

View File

@ -27,6 +27,9 @@ export function ItemEvent({ item, expanded, setExpanded }: ItemEventProps): JSX.
{item.data.properties.$pathname || item.data.properties.$current_url}
</span>
) : null}
{item.data.event === '$screen' ? (
<span className="text-muted-alt">{item.data.properties.$screen_name}</span>
) : null}
</div>
</LemonButton>

View File

@ -81,7 +81,10 @@ export const playerMetaLogic = kea<playerMetaLogicType>({
// Go through the events in reverse to find thelatest pageview
for (let i = events.length - 1; i >= 0; i--) {
const event = events[i]
if (event.event === '$pageview' && (event.playerTime ?? 0) < playerTimeClosestSecond) {
if (
(event.event === '$screen' || event.event === '$pageview') &&
(event.playerTime ?? 0) < playerTimeClosestSecond
) {
return event
}
}