Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(persons): hint at session replay when searching a session ID (#61240)

posthog[bot]ca9c0df4dbd0
diff --git a/frontend/src/scenes/persons/PersonsScene.tsx b/frontend/src/scenes/persons/PersonsScene.tsx
index 05afa0adb991..d0d976d3d212 100644
--- a/frontend/src/scenes/persons/PersonsScene.tsx
+++ b/frontend/src/scenes/persons/PersonsScene.tsx
@@ -9,6 +9,7 @@ import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
import { LemonField } from 'lib/lemon-ui/LemonField'
import { Link } from 'lib/lemon-ui/Link'
import { ButtonPrimitive } from 'lib/ui/Button/ButtonPrimitives'
+import { isUUIDLike } from 'lib/utils'
import { PersonsManagementSceneTabs } from 'scenes/persons-management/PersonsManagementSceneTabs'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene, SceneExport } from 'scenes/sceneTypes'
@@ -20,8 +21,8 @@ import { SceneMenuBar, SceneMenuBarItem, SceneMenuBarMenu } from '~/layout/scene
import { SceneTitleSection } from '~/layout/scenes/components/SceneTitleSection'
import { ScenePanel, ScenePanelActionsSection } from '~/layout/scenes/SceneLayout'
import { Query } from '~/queries/Query/Query'
-import { ProductKey } from '~/queries/schema/schema-general'
-import { CustomerProfileScope, OnboardingStepKey } from '~/types'
+import { ActorsQuery, ProductKey } from '~/queries/schema/schema-general'
+import { ActivityTab, CustomerProfileScope, OnboardingStepKey } from '~/types'
import { FeedbackButton } from 'products/customer_analytics/frontend/components/FeedbackButton'
import { PersonDisplayNameNudgeBanner } from 'products/customer_analytics/frontend/components/PersonDisplayNameNudgeBanner'
@@ -44,6 +45,11 @@ export function PersonsScene(): JSX.Element {
const queryUniqueKey = 'persons-query'
const sceneMenuBarEnabled = useFeatureFlag('SCENE_MENU_BAR')
+ // A UUID-shaped search that returns nothing is often a session ID typed into the wrong field.
+ // Session IDs aren't part of the persons query, so point the user to where they are searchable.
+ const searchTerm = (query.source as ActorsQuery | undefined)?.search?.trim()
+ const searchLooksLikeSessionId = !!searchTerm && isUUIDLike(searchTerm)
+
useOnMountEffect(() => {
loadConfigs()
})
@@ -142,31 +148,43 @@ export function PersonsScene(): JSX.Element {
setQuery={setQuery}
context={{
refresh: 'blocking',
- emptyStateHeading: currentTeam?.ingested_event
- ? 'There are no matching persons for this query'
- : 'No persons exist because no events have been ingested',
- emptyStateDetail: currentTeam?.ingested_event ? (
- <>
- This page only shows{' '}
- <Link to="https://posthog.com/docs/data/persons">identified persons</Link>. Try adjusting
- your property filters, or make sure you're calling{' '}
- <Link to="https://posthog.com/docs/product-analytics/identify">identify</Link> in your app.
- </>
- ) : (
- <>
- Go to the{' '}
- <Link
- to={urls.onboarding({
- productKey: ProductKey.PRODUCT_ANALYTICS,
- stepKey: OnboardingStepKey.INSTALL,
- })}
- data-attr="real_project_with_no_events-ingestion_link"
- >
- onboarding flow
- </Link>{' '}
- to get things moving
- </>
- ),
+ emptyStateHeading:
+ currentTeam?.ingested_event && searchLooksLikeSessionId
+ ? 'Looking for a session?'
+ : currentTeam?.ingested_event
+ ? 'There are no matching persons for this query'
+ : 'No persons exist because no events have been ingested',
+ emptyStateDetail:
+ currentTeam?.ingested_event && searchLooksLikeSessionId ? (
+ <>
+ Session IDs can't be searched here. Open it directly in{' '}
+ <Link to={urls.replaySingle(searchTerm!)}>Session replay</Link>, or search sessions on
+ the <Link to={urls.activity(ActivityTab.ExploreSessions)}>Activity</Link> page. To find
+ a person instead, search by name, email, person ID, or distinct ID.
+ </>
+ ) : currentTeam?.ingested_event ? (
+ <>
+ This page only shows{' '}
+ <Link to="https://posthog.com/docs/data/persons">identified persons</Link>. Try
+ adjusting your property filters, or make sure you're calling{' '}
+ <Link to="https://posthog.com/docs/product-analytics/identify">identify</Link> in your
+ app.
+ </>
+ ) : (
+ <>
+ Go to the{' '}
+ <Link
+ to={urls.onboarding({
+ productKey: ProductKey.PRODUCT_ANALYTICS,
+ stepKey: OnboardingStepKey.INSTALL,
+ })}
+ data-attr="real_project_with_no_events-ingestion_link"
+ >
+ onboarding flow
+ </Link>{' '}
+ to get things moving
+ </>
+ ),
baseCurrency,
}}
dataAttr="persons-table"