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.

feat(experiments): cross-sell a replay vision scanner from the recordings tab (#77967)

Kim Svatos Dugan710276e91bc3
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 0780f3e12305..ec955f5c5559 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -528,6 +528,7 @@ export const FEATURE_FLAGS = {
UNIFIED_APM_PRODUCT: 'unified-apm-product', // owner: #team-apm (@jonmcwest, @frankh), gates the shared APM product backing logs, tracing, and metrics
USER_INTERVIEWS: 'user-interviews', // owner: @Twixes @jurajmajerik
UX_REMOVE_SIDEPANEL: 'ux-remove-sidepanel', // owner: #team-surveys
+ VISION_ENTRYPOINT_EXPERIMENTS: 'vision-entrypoint-experiments', // owner: #team-replay, cross-sell entry points from experiments
VISUAL_REVIEW: 'visual-review', // owner: #team-devex
WAREHOUSE_PERSON_PROPERTIES: 'warehouse-person-properties', // owner: @tomowers #team-warehouse-sources, gates warehouse -> person properties (person-target custom property sources)
WEB_ANALYTICS_ACHIEVEMENTS: 'web-analytics-achievements', // owner: @jordanm-posthog #team-web-analytics
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 39c7b5253a05..e582942b9aa7 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -37941,6 +37941,7 @@
"experiment analyzed",
"experiment view recordings",
"experiment replay vision scanner created",
+ "experiment create scanner",
"feature flag created",
"session_replay_set_filters",
"session_replay_experiment_link_clicked",
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 79d7b64e046a..c0c34e5f42dd 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -9654,6 +9654,7 @@ export enum ProductIntentContext {
EXPERIMENT_ANALYZED = 'experiment analyzed',
EXPERIMENT_VIEW_RECORDINGS = 'experiment view recordings',
EXPERIMENT_REPLAY_VISION_SCANNER_CREATED = 'experiment replay vision scanner created',
+ EXPERIMENT_CREATE_SCANNER = 'experiment create scanner',
// Feature Flags
FEATURE_FLAG_CREATED = 'feature flag created',
diff --git a/frontend/src/scenes/experiments/ExperimentView/ExperimentReplayTab.tsx b/frontend/src/scenes/experiments/ExperimentView/ExperimentReplayTab.tsx
index ff8207a3e5f3..c57c72f6fb51 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ExperimentReplayTab.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ExperimentReplayTab.tsx
@@ -1,4 +1,5 @@
import { useActions, useValues } from 'kea'
+import { combineUrl } from 'kea-router'
import { Fragment } from 'react'
import { IconChevronDown, IconInfo } from '@posthog/icons'
@@ -14,14 +15,18 @@ import {
DropdownMenuTrigger,
} from '@posthog/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { Tooltip } from 'lib/lemon-ui/Tooltip'
import { pluralize } from 'lib/utils/strings'
import { SessionRecordingsPlaylist } from 'scenes/session-recordings/playlist/SessionRecordingsPlaylist'
import { sessionRecordingsPlaylistLogic } from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'
+import { urls } from 'scenes/urls'
import { Experiment } from '~/types'
+import { experimentScannerParams } from 'products/replay_vision/frontend/replay_scanners/experimentTargeting'
+
import { SummarizeSessionReplaysButton } from '../components/SummarizeSessionReplaysButton'
import { isLaunched } from '../experimentStatus'
import { NOT_A_FUNNEL_REASON } from '../utils'
@@ -179,6 +184,7 @@ export function ExperimentReplayTab({ experiment }: { experiment: Experiment }):
sessionBucketLoading,
sessionBucketError,
sessionBucketRequest,
+ usingExposureFallback,
} = useValues(logic)
const {
setSelectedVariantKey,
@@ -188,7 +194,9 @@ export function ExperimentReplayTab({ experiment }: { experiment: Experiment }):
playlistFiltersChanged,
recordingsLoaded,
recordingOpened,
+ scannerCrossSellClicked,
} = useActions(logic)
+ const scannerCrossSellEnabled = useFeatureFlag('VISION_ENTRYPOINT_EXPERIMENTS')
// One object feeds both the playlist below and the findMounted lookup, because the logic's
// kea key is derived from these props: hand-duplicating them at the two sites would let the
@@ -230,8 +238,33 @@ export function ExperimentReplayTab({ experiment }: { experiment: Experiment }):
}
}
+ const scannerSetupUrl = combineUrl(
+ urls.replayVisionScannerTemplate('new'),
+ experimentScannerParams({
+ experimentId: experiment.id as number,
+ variantKeys: effectiveVariantKey ? [effectiveVariantKey] : [],
+ useExposureFallback: usingExposureFallback,
+ })
+ ).url
+
return (
<div data-attr="experiment-recordings-tab">
+ {scannerCrossSellEnabled && (
+ <LemonBanner
+ type="info"
+ className="mb-2"
+ dismissKey="experiment-replay-vision-scanner-cross-sell"
+ action={{
+ children: 'Set up a scanner',
+ to: scannerSetupUrl,
+ onClick: () => scannerCrossSellClicked(),
+ 'data-attr': 'experiment-recordings-scanner-cross-sell',
+ }}
+ >
+ Replay vision can watch new recordings from this experiment for you. Scanners check each session and
+ report what they find.
+ </LemonBanner>
+ )}
<div className="mb-2 flex flex-wrap gap-2">
<LemonSegmentedButton
size="small"
diff --git a/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts b/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts
index 838d798076fa..cb0cf82f0ccf 100644
--- a/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts
@@ -28,6 +28,11 @@ import {
eventUsageLogic,
} from 'lib/utils/eventUsageLogic'
import { addProductIntentForCrossSell } from 'lib/utils/product-intents'
+import {
+ applySessionLinkability,
+ getExposureFallbackFilter,
+ getViewRecordingFiltersForVariant,
+} from 'scenes/experiments/utils'
import { playerSidebarLogic } from 'scenes/session-recordings/player/sidebar/playerSidebarLogic'
import { DEFAULT_RECORDING_FILTERS } from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'
import { teamLogic } from 'scenes/teamLogic'
@@ -186,6 +191,7 @@ export interface experimentReplayTabLogicValues {
sessionEventDeltas: ExperimentSessionEventDeltaResponseApi | null
sessionEventDeltasError: string | null
sessionEventDeltasLoading: boolean
+ usingExposureFallback: boolean
variantKeys: string[]
}
@@ -315,6 +321,9 @@ export interface experimentReplayTabLogicActions {
reportTabViewed: () => {
value: true
}
+ scannerCrossSellClicked: () => {
+ value: true
+ }
selectWatchCard: (card: ExperimentWatchCardApi | null) => {
card: ExperimentWatchCardApi | null
}
@@ -351,6 +360,7 @@ export interface experimentReplayTabLogicMeta {
variantKeys: (arg: any) => string[]
behaviorComparisonAvailable: (featureFlags: FeatureFlagsSet) => boolean
effectiveVariantKey: (selectedVariantKey: string | null, variantKeys: string[]) => string | null
+ usingExposureFallback: (linkabilityLoaded: boolean, unlinkableEventNames: Set<string>, arg: any) => boolean
metricOptions: (
linkabilityLoaded: boolean,
unlinkableEventNames: Set<string>,
@@ -444,6 +454,7 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
watchHighlightOpened: (card: ExperimentWatchCardApi, position: number) => ({ card, position }),
prefetchSessionContexts: (sessionIds: string[]) => ({ sessionIds }),
reportTabViewed: true,
+ scannerCrossSellClicked: true,
}),
loaders(({ values, props, actions }) => ({
sessionBucket: [
@@ -644,6 +655,21 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
// filter could only match zero sessions. Those stay listed with their reason rather than
// vanishing, which reads as the metric having been forgotten. Fails open while the check
// loads.
+ // The recordings tab itself is now person-scoped, but a scanner filters recordings by a
+ // persisted RecordingsQuery, which can't express person-scoped exposure (the experiment_exposure
+ // filter refuses userless callers). So the cross-sell scanner link still needs the old
+ // event/property exposure filter, and this tells it whether to use the server-side-exposure
+ // fallback shape. Fails open (false) while the linkability check loads.
+ usingExposureFallback: [
+ (s) => [s.linkabilityLoaded, s.unlinkableEventNames, (_, props) => props.experiment],
+ (linkabilityLoaded: boolean, unlinkableEventNames: Set<string>, experiment: Experiment): boolean =>
+ linkabilityLoaded &&
+ applySessionLinkability(
+ getViewRecordingFiltersForVariant(experiment),
+ unlinkableEventNames,
+ getExposureFallbackFilter(experiment)
+ ).usedExposureFallback,
+ ],
metricOptions: [
(s) => [s.linkabilityLoaded, s.unlinkableEventNames, (_, props) => props.experiment],
(
@@ -1007,6 +1033,13 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
linkable_metric_count: values.metricOptions.filter((option) => !option.unlinkable).length,
})
},
+ scannerCrossSellClicked: () => {
+ void addProductIntentForCrossSell({
+ from: ProductKey.EXPERIMENTS,
+ to: ProductKey.REPLAY_VISION,
+ intent_context: ProductIntentContext.EXPERIMENT_CREATE_SCANNER,
+ })
+ },
prefetchSessionContexts: async ({ sessionIds }, breakpoint) => {
if (!values.featureFlags[FEATURE_FLAGS.REPLAY_EXPERIMENT_CONTEXT] || sessionIds.length === 0) {
return
diff --git a/posthog/schema_enums.py b/posthog/schema_enums.py
index c5a5061b1c95..afcc9332728f 100644
--- a/posthog/schema_enums.py
+++ b/posthog/schema_enums.py
@@ -3430,6 +3430,7 @@ class ProductIntentContext(StrEnum):
EXPERIMENT_ANALYZED = "experiment analyzed"
EXPERIMENT_VIEW_RECORDINGS = "experiment view recordings"
EXPERIMENT_REPLAY_VISION_SCANNER_CREATED = "experiment replay vision scanner created"
+ EXPERIMENT_CREATE_SCANNER = "experiment create scanner"
FEATURE_FLAG_CREATED = "feature flag created"
SESSION_REPLAY_SET_FILTERS = "session_replay_set_filters"
SESSION_REPLAY_EXPERIMENT_LINK_CLICKED = "session_replay_experiment_link_clicked"