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(experiments): avoid disabling "view recordings" button for better UX (#102548)

Marcel Poelker2faaeca749c9
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 90c4d8d97603..b25fd255ead8 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -7948,6 +7948,14 @@ snapshots:
hash: v1.k794b7964.a4753ab565ca3f44ae93f0bf19bb4bd25b2544c1bb796cebbd3a16b6aa146db5.k7wPrw7XnQ4KdxWMRQ9gVWew1fhgPOLCUVIuC24Kp1c
scenes-app-experiments--experiment-frequentist-two-variants--light:
hash: v1.k794b7964.c3d7500050335234dac2b12a58ae26fe68611d4f4fb040ab162a0b22aa2816c4.yZkCSjTEKndRt6r5t2hSlLwgfIwnnDg5or8MZX0tAz0
+ scenes-app-experiments--experiment-recordings-dropped-metric--dark:
+ hash: v1.k794b7964.6d762bcb980b2919d0e2498bf6c850b1316ba04104f2ccd255000a06bd370170.3TepvXurqsNhulYyGoaiEVGuBJk3sKal1payRQxC14g
+ scenes-app-experiments--experiment-recordings-dropped-metric--light:
+ hash: v1.k794b7964.f5e66e066839e5a4542be1bfb0f6389f038c17076a6ad7faa72622eccaac7d9b.iiymbquQviYKxBr137ygkJ2Si88uul_5B-T7zKgi0fE
+ scenes-app-experiments--experiment-recordings-dropped-metric-narrow--dark:
+ hash: v1.k794b7964.069e1249891372e54e84e040cd3f43ba600004fcd59ab7b9689ec495da58b7ec.4ApPgf5n4BibfVuJvy-REYEOLTV5e8rklvJ7ALnZ7Dk
+ scenes-app-experiments--experiment-recordings-dropped-metric-narrow--light:
+ hash: v1.k794b7964.f1bd468eefa803b8c9291d366e678d6ad383e48e2321cda555873d116275f820.a60CsAKOwszUOfeYLNZ4XXL8V88RDOpBSt5IkUJfv3w
scenes-app-experiments--experiment-recordings-empty-ended-past-retention--dark:
hash: v1.k794b7964.557c37efd8493be197bc3abf9814f8e3cbc9436cea359aa6f0e2c4a476a017b9.qLJQ9vTIuxXylC9XI8GS2Jbqjcl8XDfW5dnyVMEbM9E
scenes-app-experiments--experiment-recordings-empty-ended-past-retention--light:
@@ -8004,6 +8012,10 @@ snapshots:
hash: v1.k794b7964.3f165672892e5dd4df5d38df6526833dc4db99e4e35930fa4fe3d3fd4b1f12a8.B_2KJg022Ypa6oThtqLsngXvU0YeWoIc9q0-PgBYl6c
scenes-app-experiments--experiment-results-row-recording-links-narrow--light:
hash: v1.k794b7964.51601e5cdf3ee801c3cb93ef4d805ec9ce0401bab611a957001b911f66676e4e.P9mT7PBVcRd9xPGUgJRcxtIsVAjHHLDz6H6fB40Vkt0
+ scenes-app-experiments--experiment-results-row-recording-links-unselectable-metric--dark:
+ hash: v1.k794b7964.fc91085a9ccf6f1abcfa44b2c406f254f00756f9756c0a5ae7432cecbd1cad2f.btpKN_Waz3jWcsQ3_T-kXH_6UBBkfPrQz6NH4pP-cpM
+ scenes-app-experiments--experiment-results-row-recording-links-unselectable-metric--light:
+ hash: v1.k794b7964.e5c8c2db2f07793a503706854aeecedf60ac676c72aefc358a06d8233452b175.qqR2YNEpUBy2pyRr8WRoXOV74cJiOjNsHjJ0AzSRPKA
scenes-app-experiments--experiment-stopped-with-conclusion--dark:
hash: v1.k794b7964.e347bbe9e217d7cbd915b09b362a9d995285c1f6492229235ce3dcef74e49f30.5xV99CaEDXp-xFACHoS4M9vQ6zFGOjestb-iW79F5Q4
scenes-app-experiments--experiment-stopped-with-conclusion--light:
diff --git a/frontend/src/lib/utils/eventUsageLogic.ts b/frontend/src/lib/utils/eventUsageLogic.ts
index b88bf92c3ad3..17c367ae4fb5 100644
--- a/frontend/src/lib/utils/eventUsageLogic.ts
+++ b/frontend/src/lib/utils/eventUsageLogic.ts
@@ -135,6 +135,12 @@ export interface ExperimentRecordingsTabContext {
* which is the ordinary case, so this is what separates the two populations in a report.
*/
entry_point: string | null
+ /**
+ * Why the results row that opened this visit could not hand its metric to the tab, so the list
+ * shows every recording of the variant instead. Null on every other visit. Kept as a string
+ * rather than the scene's union so telemetry doesn't import from the scene.
+ */
+ metric_unavailable_reason: string | null
variant_count: number
metric_count: number
linkable_metric_count: number
@@ -170,6 +176,13 @@ export interface ExperimentRecordingsFilterContext {
* results row produced can be told from one somebody narrowed into by hand.
*/
entry_point: string | null
+ /**
+ * Why the results row that opened this visit could not hand its metric to the tab, so the list
+ * shows every recording of the variant instead. Null on every other visit, and null once the
+ * viewer moves a facet themselves, for the same reason `entry_point` is. Kept as a string
+ * rather than the scene's union so telemetry doesn't import from the scene.
+ */
+ metric_unavailable_reason: string | null
}
/**
diff --git a/frontend/src/scenes/experiments/ExperimentView/ExperimentReplayTab.tsx b/frontend/src/scenes/experiments/ExperimentView/ExperimentReplayTab.tsx
index dd3c5b67d3fe..e573d70f5a7d 100644
--- a/frontend/src/scenes/experiments/ExperimentView/ExperimentReplayTab.tsx
+++ b/frontend/src/scenes/experiments/ExperimentView/ExperimentReplayTab.tsx
@@ -33,7 +33,7 @@ import { scannerTypeLabel } from 'products/replay_vision/frontend/replay_scanner
import { NOT_A_FUNNEL_REASON } from '../utils'
import { ExperimentBehaviorComparison, ExperimentBehaviorComparisonToggle } from './ExperimentBehaviorComparison'
-import { EXPERIMENT_RECORDING_MODE_OPTIONS } from './experimentRecordingModes'
+import { EXPERIMENT_RECORDING_MODE_OPTIONS, METRIC_UNSELECTABLE_COPY } from './experimentRecordingModes'
import { type ExperimentReplayMetricFilterMode, isFunnelMode } from './experimentRecordingsDeepLink'
import { ExperimentRecordingsListEmptyState } from './ExperimentRecordingsListEmptyState'
import {
@@ -265,6 +265,8 @@ export function ExperimentReplayTab({ experiment }: { experiment: Experiment }):
effectiveMetricUuids,
metricOptions,
metricFilterMode,
+ droppedMetricReason,
+ filtersCustomized,
sessionBucket,
sessionBucketLoading,
sessionBucketError,
@@ -475,9 +477,15 @@ export function ExperimentReplayTab({ experiment }: { experiment: Experiment }):
<ExperimentBehaviorComparisonToggle experiment={experiment} />
</div>
{/* The default mode also uses the endpoint for a single multi-source metric, so the
- caption follows the request, not the mode. */}
+ caption follows the request, not the mode. The dropped-metric caption claims a whole
+ population, so a filter the viewer added in the playlist bar makes it wrong and takes
+ it away. The telemetry nulls the reason on the same condition. */}
<div className="mb-2 flex items-center gap-2 text-xs text-secondary">
- {clientSideFilterApplied ? null : !sessionBucketRequest && metricFilterMode === 'fired_all' ? (
+ {clientSideFilterApplied ? null : droppedMetricReason && !filtersCustomized ? (
+ <span data-attr="experiment-recordings-dropped-metric-caption">
+ {METRIC_UNSELECTABLE_COPY[droppedMetricReason].onTab}
+ </span>
+ ) : !sessionBucketRequest && metricFilterMode === 'fired_all' ? (
<span data-attr="experiment-recordings-population-caption">
{effectiveExposureScope === 'in_session' ? inSessionCopy.caption : ALL_EXPOSED_CAPTION}
</span>
diff --git a/frontend/src/scenes/experiments/ExperimentView/experimentRecordingModes.test.ts b/frontend/src/scenes/experiments/ExperimentView/experimentRecordingModes.test.ts
index dbcb673b48c2..5668cee34aac 100644
--- a/frontend/src/scenes/experiments/ExperimentView/experimentRecordingModes.test.ts
+++ b/frontend/src/scenes/experiments/ExperimentView/experimentRecordingModes.test.ts
@@ -1,13 +1,7 @@
import { ExperimentMetric, ExperimentMetricType, NodeKind } from '~/queries/schema/schema-general'
-import {
- DATA_WAREHOUSE_UNLINKABLE_REASON,
- FUNNEL_DATA_WAREHOUSE_COMPLETION_REASON,
- FUNNEL_SERVER_SIDE_COMPLETION_REASON,
- METRIC_UNLINKABLE_REASON,
- RETENTION_UNLINKABLE_REASON,
-} from '../utils'
-import { METRIC_WITHOUT_UUID_REASON, getMetricRecordingModes } from './experimentRecordingModes'
+import { FUNNEL_DATA_WAREHOUSE_COMPLETION_REASON, FUNNEL_SERVER_SIDE_COMPLETION_REASON } from '../utils'
+import { METRIC_UNSELECTABLE_COPY, getMetricRecordingModes } from './experimentRecordingModes'
const meanMetric = (source: Record<string, unknown>): ExperimentMetric =>
({
@@ -44,6 +38,7 @@ describe('getMetricRecordingModes', () => {
unlinkable: [],
expected: {
metricSelectable: true,
+ unselectableCode: null,
defaultMode: 'funnel_completed',
labels: ['Finished funnel', "Didn't finish funnel"],
disabledReasons: [null, null],
@@ -57,6 +52,7 @@ describe('getMetricRecordingModes', () => {
unlinkable: ['checkout_finished'],
expected: {
metricSelectable: true,
+ unselectableCode: null,
defaultMode: 'fired_all',
labels: ['Finished funnel', "Didn't finish funnel"],
disabledReasons: [FUNNEL_SERVER_SIDE_COMPLETION_REASON, FUNNEL_SERVER_SIDE_COMPLETION_REASON],
@@ -71,6 +67,7 @@ describe('getMetricRecordingModes', () => {
unlinkable: [],
expected: {
metricSelectable: true,
+ unselectableCode: null,
defaultMode: 'fired_all',
labels: ['Finished funnel', "Didn't finish funnel"],
disabledReasons: [FUNNEL_DATA_WAREHOUSE_COMPLETION_REASON, FUNNEL_DATA_WAREHOUSE_COMPLETION_REASON],
@@ -82,6 +79,7 @@ describe('getMetricRecordingModes', () => {
unlinkable: [],
expected: {
metricSelectable: true,
+ unselectableCode: null,
defaultMode: 'fired_all',
labels: ['Fired purchase', "Didn't fire purchase"],
disabledReasons: [null, null],
@@ -95,6 +93,7 @@ describe('getMetricRecordingModes', () => {
unlinkable: [],
expected: {
metricSelectable: true,
+ unselectableCode: null,
defaultMode: 'fired_all',
labels: ['Fired metric events', "Didn't fire metric events"],
disabledReasons: [null, null],
@@ -108,6 +107,7 @@ describe('getMetricRecordingModes', () => {
unlinkable: [],
expected: {
metricSelectable: true,
+ unselectableCode: null,
defaultMode: 'fired_all',
labels: ['Fired revenue or $pageview', "Didn't fire revenue or $pageview"],
disabledReasons: [null, null],
@@ -119,6 +119,7 @@ describe('getMetricRecordingModes', () => {
unlinkable: [],
expected: {
metricSelectable: true,
+ unselectableCode: null,
defaultMode: 'fired_all',
labels: ['Fired purchase', "Didn't fire purchase"],
disabledReasons: [null, null],
@@ -132,7 +133,11 @@ describe('getMetricRecordingModes', () => {
metricSelectable: false,
defaultMode: null,
labels: ['Fired purchase', "Didn't fire purchase"],
- disabledReasons: [METRIC_UNLINKABLE_REASON, METRIC_UNLINKABLE_REASON],
+ unselectableCode: 'server_side_events',
+ disabledReasons: [
+ METRIC_UNSELECTABLE_COPY.server_side_events.onRow,
+ METRIC_UNSELECTABLE_COPY.server_side_events.onRow,
+ ],
},
},
{
@@ -149,7 +154,8 @@ describe('getMetricRecordingModes', () => {
metricSelectable: false,
defaultMode: null,
labels: ['Fired metric events', "Didn't fire metric events"],
- disabledReasons: [RETENTION_UNLINKABLE_REASON, RETENTION_UNLINKABLE_REASON],
+ unselectableCode: 'retention',
+ disabledReasons: [METRIC_UNSELECTABLE_COPY.retention.onRow, METRIC_UNSELECTABLE_COPY.retention.onRow],
},
},
{
@@ -160,7 +166,11 @@ describe('getMetricRecordingModes', () => {
metricSelectable: false,
defaultMode: null,
labels: ['Fired metric events', "Didn't fire metric events"],
- disabledReasons: [DATA_WAREHOUSE_UNLINKABLE_REASON, DATA_WAREHOUSE_UNLINKABLE_REASON],
+ unselectableCode: 'data_warehouse',
+ disabledReasons: [
+ METRIC_UNSELECTABLE_COPY.data_warehouse.onRow,
+ METRIC_UNSELECTABLE_COPY.data_warehouse.onRow,
+ ],
},
},
{
@@ -173,7 +183,8 @@ describe('getMetricRecordingModes', () => {
metricSelectable: false,
defaultMode: null,
labels: ['Fired purchase', "Didn't fire purchase"],
- disabledReasons: [METRIC_WITHOUT_UUID_REASON, METRIC_WITHOUT_UUID_REASON],
+ unselectableCode: 'no_uuid',
+ disabledReasons: [METRIC_UNSELECTABLE_COPY.no_uuid.onRow, METRIC_UNSELECTABLE_COPY.no_uuid.onRow],
},
},
])('$case', ({ metric, unlinkable, expected }) => {
@@ -183,6 +194,7 @@ describe('getMetricRecordingModes', () => {
expect({
metricSelectable: modes.metricSelectable,
+ unselectableCode: modes.unselectableCode,
defaultMode: modes.defaultMode,
labels: modes.menuItems.map((item) => item.label),
disabledReasons: modes.menuItems.map((item) => item.disabledReason),
@@ -195,6 +207,7 @@ describe('getMetricRecordingModes', () => {
const modes = getMetricRecordingModes(meanMetric(event('purchase')), new Set())
expect(modes.metricSelectable).toBe(true)
+ expect(modes.unselectableCode).toBeNull()
expect(modes.menuItems.map((item) => item.disabledReason)).toEqual([null, null])
})
})
diff --git a/frontend/src/scenes/experiments/ExperimentView/experimentRecordingModes.ts b/frontend/src/scenes/experiments/ExperimentView/experimentRecordingModes.ts
index 2c154b9e5858..775047b6ea0f 100644
--- a/frontend/src/scenes/experiments/ExperimentView/experimentRecordingModes.ts
+++ b/frontend/src/scenes/experiments/ExperimentView/experimentRecordingModes.ts
@@ -4,11 +4,33 @@ import {
getFunnelDropoffReason,
getMetricSessionFilters,
getMetricSourceEventNames,
- getMetricUnlinkableReason,
+ getMetricUnlinkableCode,
} from '../utils'
-import type { ExperimentReplayMetricFilterMode } from './experimentRecordingsDeepLink'
+import type { ExperimentMetricUnselectableCode, ExperimentReplayMetricFilterMode } from './experimentRecordingsDeepLink'
-export const METRIC_WITHOUT_UUID_REASON = "This metric can't be selected on the Recordings tab."
+/**
+ * The reason a results row cannot filter recordings by this metric, worded for each surface. The
+ * row's phrasing points at the tab; the tab's own phrasing cannot, since the reader is already
+ * there and needs to know what the list they are looking at contains.
+ */
+export const METRIC_UNSELECTABLE_COPY: Record<ExperimentMetricUnselectableCode, { onRow: string; onTab: string }> = {
+ no_uuid: {
+ onRow: "This metric can't filter recordings yet, so the button opens every recording of the variant.",
+ onTab: "Showing every recording of this variant. This metric can't filter recordings yet.",
+ },
+ server_side_events: {
+ onRow: "This metric's events are captured server-side without a session ID, so the button opens every recording of the variant.",
+ onTab: "Showing every recording of this variant. This metric's events are captured server-side without a session ID, so they can't be matched to recordings.",
+ },
+ retention: {
+ onRow: 'Retention metrics measure a return visit in a later session, so the button opens every recording of the variant.',
+ onTab: 'Showing every recording of this variant. Retention metrics measure a return visit, which happens in a later session, so no single recording can show it.',
+ },
+ data_warehouse: {
+ onRow: 'This metric is measured in the data warehouse, so the button opens every recording of the variant.',
+ onTab: 'Showing every recording of this variant. This metric is measured in the data warehouse, which has no session events to match recordings on.',
+ },
+}
/**
* The modes a results row offers. A row's link carries a single metric, and over one metric
@@ -144,6 +166,8 @@ export interface ExperimentRecordingModes {
/** False when the Recordings tab would drop this metric, so a link to it must carry no metric. */
metricSelectable: boolean
unselectableReason: string | null
+ /** The reason as a telemetry value, paired with `unselectableReason`. Null when selectable. */
+ unselectableCode: ExperimentMetricUnselectableCode | null
/** The mode a one-click link applies. Null when the metric can't be selected. */
defaultMode: ExperimentReplayMetricFilterMode | null
/**
@@ -168,8 +192,10 @@ export function getMetricRecordingModes(
): ExperimentRecordingModes {
// The tab selects a metric by uuid and skips the ones without it, so a link to a uuid-less
// metric would land on a list the metric filter never reaches.
- const unselectableReason =
- (metric.uuid ? null : METRIC_WITHOUT_UUID_REASON) ?? getMetricUnlinkableReason(metric, unlinkableEventNames)
+ const unselectableCode: ExperimentMetricUnselectableCode | null = metric.uuid
+ ? getMetricUnlinkableCode(metric, unlinkableEventNames)
+ : 'no_uuid'
+ const unselectableReason = unselectableCode === null ? null : METRIC_UNSELECTABLE_COPY[unselectableCode].onRow
const funnel = isExperimentFunnelMetric(metric)
// Both funnel modes read the last step, so a step no recording can be matched on disables the
// pair rather than one half of it.
@@ -190,6 +216,7 @@ export function getMetricRecordingModes(
return {
metricSelectable: unselectableReason === null,
unselectableReason,
+ unselectableCode,
defaultMode,
menuItems: [
{ mode: modes[0], ...MODE_COPY[modes[0]].menu(eventNames), disabledReason },
diff --git a/frontend/src/scenes/experiments/ExperimentView/experimentRecordingsDeepLink.ts b/frontend/src/scenes/experiments/ExperimentView/experimentRecordingsDeepLink.ts
index 80c74441458a..0f5b53398c87 100644
--- a/frontend/src/scenes/experiments/ExperimentView/experimentRecordingsDeepLink.ts
+++ b/frontend/src/scenes/experiments/ExperimentView/experimentRecordingsDeepLink.ts
@@ -38,13 +38,33 @@ export const EXPERIMENT_RECORDINGS_ENTRY_POINTS = ['results_button', 'results_me
export type ExperimentRecordingsEntryPoint = (typeof EXPERIMENT_RECORDINGS_ENTRY_POINTS)[number]
+/**
+ * Why a results row could not hand its metric to the tab, as a value telemetry counts. The codes
+ * live here rather than next to the copy they resolve to, because `experimentRecordingModes.ts`
+ * imports from this module and the reverse would close a cycle.
+ */
+export const EXPERIMENT_METRIC_UNSELECTABLE_CODES = [
+ 'no_uuid',
+ 'server_side_events',
+ 'retention',
+ 'data_warehouse',
+] as const
+
+export type ExperimentMetricUnselectableCode = (typeof EXPERIMENT_METRIC_UNSELECTABLE_CODES)[number]
+
/**
* The search params that preselect the recordings tab, so a results row can open the population it
* names instead of the replay page's own list. The tab consumes them on mount and removes them from
* the URL, after which its persisted state is the source of truth. `metric` is taken by the
* create flow's prefill, so the metric param here is `metric_uuid`.
*/
-export const EXPERIMENT_RECORDINGS_DEEP_LINK_PARAMS = ['variant', 'metric_uuid', 'metric_filter', 'entry'] as const
+export const EXPERIMENT_RECORDINGS_DEEP_LINK_PARAMS = [
+ 'variant',
+ 'metric_uuid',
+ 'metric_filter',
+ 'entry',
+ 'metric_unavailable',
+] as const
export interface ExperimentRecordingsDeepLink {
/** A variant key of the experiment's flag. Null selects every variant. */
@@ -55,6 +75,11 @@ export interface ExperimentRecordingsDeepLink {
metricFilterMode: ExperimentReplayMetricFilterMode | null
/** Null for a link that names no control, which leaves the reported entry point null. */
entry: ExperimentRecordingsEntryPoint | null
+ /**
+ * Why the link carries no metric, when a results row wanted one and could not use it. Null on
+ * every other link, including one that simply names no metric.
+ */
+ metricUnavailable: ExperimentMetricUnselectableCode | null
}
/** The recordings tab's key in the experiment scene's tab bar. */
@@ -67,15 +92,16 @@ export function experimentRecordingsUrl(experimentId: ExperimentIdType, link: Ex
...(link.metricUuid !== null ? { metric_uuid: link.metricUuid } : {}),
...(link.metricFilterMode !== null ? { metric_filter: link.metricFilterMode } : {}),
...(link.entry !== null ? { entry: link.entry } : {}),
+ ...(link.metricUnavailable !== null ? { metric_unavailable: link.metricUnavailable } : {}),
}).url
}
/**
- * Null when the URL carries none of the three keys, which is the ordinary case and must not move
- * the tab's persisted state. A value the experiment does not own is left to the tab's own
- * selectors, which drop an unknown variant key or metric uuid, so a stale link degrades to the
- * tab's defaults. An unknown mode or entry point is dropped here instead, against the closed lists
- * above.
+ * Null when the URL carries none of the keys, which is the ordinary case and must not move the
+ * tab's persisted state. A value the experiment does not own is left to the tab's own selectors,
+ * which drop an unknown variant key or metric uuid, so a stale link degrades to the tab's defaults.
+ * An unknown mode, entry point, or reason code is dropped here instead, against the closed lists
+ * above, so a hand-edited URL cannot inject a value.
*/
export function parseExperimentRecordingsDeepLink(
searchParams: Record<string, any>
@@ -89,5 +115,7 @@ export function parseExperimentRecordingsDeepLink(
metricFilterMode:
EXPERIMENT_REPLAY_METRIC_FILTER_MODES.find((mode) => mode === searchParams.metric_filter) ?? null,
entry: EXPERIMENT_RECORDINGS_ENTRY_POINTS.find((entry) => entry === searchParams.entry) ?? null,
+ metricUnavailable:
+ EXPERIMENT_METRIC_UNSELECTABLE_CODES.find((code) => code === searchParams.metric_unavailable) ?? null,
}
}
diff --git a/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.test.ts b/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.test.ts
index 2019c31e3acb..51018c98ba26 100644
--- a/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.test.ts
+++ b/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.test.ts
@@ -1058,6 +1058,7 @@ describe('experimentReplayTabLogic', () => {
is_bucketed: false,
watch_card_kind: null,
entry_point: null,
+ metric_unavailable_reason: null,
})
filled.unmount()
})
@@ -1065,24 +1066,44 @@ describe('experimentReplayTabLogic', () => {
it('reports the entry point a deep link set, and clears it when the viewer moves a facet', async () => {
// The entry point is what separates a list a results row opened from one somebody narrowed
// by hand, so an empty rate can be read per entry point. Left set after a manual change, it
- // would credit the results row with lists it never asked for.
+ // would credit the results row with lists it never asked for. The dropped-metric reason is
+ // read the same way, and it is also what the tab's caption explains the list with.
const captureSpy = jest.spyOn(posthog, 'capture').mockReturnValue(undefined as any)
teamLogic.actions.loadCurrentTeamSuccess(MOCK_DEFAULT_TEAM)
- router.actions.push('/experiments/63', { tab: 'recordings', variant: 'test', entry: 'results_button' })
+ router.actions.push('/experiments/63', {
+ tab: 'recordings',
+ variant: 'test',
+ entry: 'results_button',
+ metric_unavailable: 'no_uuid',
+ })
const fromResults = experimentReplayTabLogic({
experiment: { ...EXPERIMENT, id: 63, start_date: daysAgo(10), end_date: daysAgo(2) } as Experiment,
})
fromResults.mount()
await expectLogic(fromResults).toFinishAllListeners()
+ expect(fromResults.values.droppedMetricReason).toBe('no_uuid')
+ // Left in the URL it would re-apply on the next remount and caption a list the viewer has
+ // since narrowed themselves.
+ expect(router.values.searchParams).toEqual({ tab: 'recordings' })
+
fromResults.actions.recordingsLoaded(loadedPage(['s1']))
await expectLogic(fromResults).toFinishAllListeners()
- expect(listsRendered(captureSpy, 63)[0][1]).toMatchObject({ entry_point: 'results_button', variant: 'test' })
+ expect(listsRendered(captureSpy, 63)[0][1]).toMatchObject({
+ entry_point: 'results_button',
+ metric_unavailable_reason: 'no_uuid',
+ variant: 'test',
+ })
fromResults.actions.setSelectedVariantKey(null)
fromResults.actions.recordingsLoaded(loadedPage(['s1']))
await expectLogic(fromResults).toFinishAllListeners()
- expect(listsRendered(captureSpy, 63)[1][1]).toMatchObject({ entry_point: null, variant: null })
+ expect(fromResults.values.droppedMetricReason).toBeNull()
+ expect(listsRendered(captureSpy, 63)[1][1]).toMatchObject({
+ entry_point: null,
+ metric_unavailable_reason: null,
+ variant: null,
+ })
fromResults.unmount()
})
@@ -1092,7 +1113,12 @@ describe('experimentReplayTabLogic', () => {
// moving one is the other way to clear the entry point and would hide this one failing.
const captureSpy = jest.spyOn(posthog, 'capture').mockReturnValue(undefined as any)
teamLogic.actions.loadCurrentTeamSuccess(MOCK_DEFAULT_TEAM)
- router.actions.push('/experiments/67', { tab: 'recordings', variant: 'test', entry: 'results_button' })
+ router.actions.push('/experiments/67', {
+ tab: 'recordings',
+ variant: 'test',
+ entry: 'results_button',
+ metric_unavailable: 'no_uuid',
+ })
const fromResults = experimentReplayTabLogic({
experiment: { ...EXPERIMENT, id: 67, start_date: daysAgo(10), end_date: daysAgo(2) } as Experiment,
})
@@ -1115,7 +1141,13 @@ describe('experimentReplayTabLogic', () => {
await expectLogic(fromResults).toFinishAllListeners()
expect(fromResults.values.entryPoint).toBe('results_button')
- expect(listsRendered(captureSpy, 67)[0][1]).toMatchObject({ entry_point: null, variant: 'test' })
+ // The reducer keeps the reason, so the caption still explains the list the link opened.
+ expect(fromResults.values.droppedMetricReason).toBe('no_uuid')
+ expect(listsRendered(captureSpy, 67)[0][1]).toMatchObject({
+ entry_point: null,
+ metric_unavailable_reason: null,
+ variant: 'test',
+ })
fromResults.unmount()
})
diff --git a/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts b/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts
index 83f79b593d4d..673c098fbd8b 100644
--- a/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentView/experimentReplayTabLogic.ts
@@ -87,6 +87,7 @@ import {
} from '../utils'
import { viewRecordingsLinkabilityLogic } from '../viewRecordingsLinkabilityLogic'
import {
+ type ExperimentMetricUnselectableCode,
type ExperimentRecordingsDeepLink,
type ExperimentRecordingsEntryPoint,
type ExperimentReplayMetricFilterMode,
@@ -370,6 +371,7 @@ export interface experimentReplayTabLogicValues {
behaviorComparisonOpen: boolean
behaviorComparisonUnavailableReason: ExperimentBehaviorComparisonUnavailableReason | null
bucketSessionIds: string[] | undefined
+ droppedMetricReason: ExperimentMetricUnselectableCode | null
durationFilterActive: boolean
durationFilterCustomized: boolean
effectiveExposureScope: ExperimentReplayExposureScope
@@ -723,6 +725,7 @@ export interface experimentReplayTabLogicMeta {
bucketSessionIds: string[] | undefined,
selectedWatchCard: ExperimentWatchCardApi | null,
entryPoint: 'results_button' | 'results_menu' | null,
+ droppedMetricReason: 'data_warehouse' | 'no_uuid' | 'retention' | 'server_side_events' | null,
filtersCustomized: boolean
) => ExperimentRecordingsFilterContext
tabViewContext: (
@@ -732,7 +735,8 @@ export interface experimentReplayTabLogicMeta {
inSessionExposure: ExperimentInSessionExposureApi | null,
behaviorComparisonAvailable: boolean,
behaviorComparisonUnavailableReason: 'group_aggregated' | null,
- entryPoint: 'results_button' | 'results_menu' | null
+ entryPoint: 'results_button' | 'results_menu' | null,
+ droppedMetricReason: 'data_warehouse' | 'no_uuid' | 'retention' | 'server_side_events' | null
) => ExperimentRecordingsTabContext
metricOptions: (
linkabilityLoaded: boolean,
@@ -1170,6 +1174,21 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
selectWatchCard: () => null,
},
],
+ // Why the link that opened this visit carried no metric. Not persisted, and cleared by the
+ // same actions that clear the entry point: once the viewer moves a facet themselves, the
+ // list no longer answers the results row's question and the explanation would describe
+ // something they left behind.
+ droppedMetricReason: [
+ null as ExperimentMetricUnselectableCode | null,
+ {
+ applyDeepLink: (_, { link }) => link.metricUnavailable,
+ setSelectedVariantKey: () => null,
+ setExposureScope: () => null,
+ setMetricSelected: () => null,
+ setMetricFilterMode: () => null,
+ selectWatchCard: () => null,
+ },
+ ],
}),
selectors({
loadedRecordingsById: [
@@ -1446,6 +1465,7 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
s.bucketSessionIds,
s.selectedWatchCard,
s.entryPoint,
+ s.droppedMetricReason,
s.filtersCustomized,
],
(
@@ -1456,6 +1476,7 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
bucketSessionIds: string[] | undefined,
selectedWatchCard: ExperimentWatchCardApi | null,
entryPoint: ExperimentRecordingsEntryPoint | null,
+ droppedMetricReason: ExperimentMetricUnselectableCode | null,
filtersCustomized: boolean
): ExperimentRecordingsFilterContext => ({
variant: effectiveVariantKey,
@@ -1468,6 +1489,7 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
// asked for, the same as moving one of the tab's own facets. Read off the playlist
// rather than its change action, which also fires on the tab's own pushes.
entry_point: filtersCustomized ? null : entryPoint,
+ metric_unavailable_reason: filtersCustomized ? null : droppedMetricReason,
}),
],
// The `experiment recordings tab viewed` payload, in a selector so the settled-checks
@@ -1481,6 +1503,7 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
s.behaviorComparisonAvailable,
s.behaviorComparisonUnavailableReason,
s.entryPoint,
+ s.droppedMetricReason,
],
(
variantKeys: string[],
@@ -1489,9 +1512,11 @@ export const experimentReplayTabLogic = kea<experimentReplayTabLogicType>([
inSessionExposure: ExperimentInSessionExposureApi | null,
behaviorComparisonAvailable: boolean,
behaviorComparisonUnavailableReason: ExperimentBehaviorComparisonUnavailableReason | null,
- entryPoint: ExperimentRecordingsEntryPoint | null
+ entryPoint: ExperimentRecordingsEntryPoint | null,
+ droppedMetricReason: ExperimentMetricUnselectableCode | null
): ExperimentRecordingsTabContext => ({
entry_point: entryPoint,
+ metric_unavailable_reason: droppedMetricReason,
variant_count: variantKeys.length,
metric_count: metricOptions.length,
linkable_metric_count: metricOptions.filter((option) => !option.unlinkable).length,
diff --git a/frontend/src/scenes/experiments/MetricsView/new/VariantRecordingsButton.test.tsx b/frontend/src/scenes/experiments/MetricsView/new/VariantRecordingsButton.test.tsx
index d5e2f6243c4e..7f7d595e4149 100644
--- a/frontend/src/scenes/experiments/MetricsView/new/VariantRecordingsButton.test.tsx
+++ b/frontend/src/scenes/experiments/MetricsView/new/VariantRecordingsButton.test.tsx
@@ -1,8 +1,12 @@
import { render } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
+import { router } from 'kea-router'
+import posthog from 'posthog-js'
import { type ExperimentRecordingModes } from 'scenes/experiments/ExperimentView/experimentRecordingModes'
import { ExperimentMetric, ExperimentMetricType, NodeKind } from '~/queries/schema/schema-general'
+import { initKeaTests } from '~/test/init'
import { Experiment } from '~/types'
import { VariantRecordingsButton } from './VariantRecordingsButton'
@@ -19,6 +23,7 @@ const metric = {
const modes = (overrides: Partial<ExperimentRecordingModes>): ExperimentRecordingModes => ({
metricSelectable: true,
unselectableReason: null,
+ unselectableCode: null,
defaultMode: 'fired_all',
menuItems: [
{ mode: 'fired_all', label: 'Fired purchase', tooltip: '', disabledReason: null },
@@ -27,43 +32,109 @@ const modes = (overrides: Partial<ExperimentRecordingModes>): ExperimentRecordin
...overrides,
})
+const droppedMetricModes = (): ExperimentRecordingModes =>
+ modes({
+ metricSelectable: false,
+ unselectableReason: 'Retention metrics measure a return visit in a later session.',
+ unselectableCode: 'retention',
+ defaultMode: null,
+ menuItems: [
+ {
+ mode: 'fired_all',
+ label: 'Fired purchase',
+ tooltip: '',
+ disabledReason: 'Retention metrics measure a return visit in a later session.',
+ },
+ {
+ mode: 'no_metric_activity',
+ label: "Didn't fire purchase",
+ tooltip: '',
+ disabledReason: 'Retention metrics measure a return visit in a later session.',
+ },
+ ],
+ })
+
+/** The whole param set, so a param the link must not carry fails the assertion by being present. */
+const linkParams = (element: Element | null): Record<string, string> =>
+ Object.fromEntries(new URLSearchParams(element?.getAttribute('href')?.split('?')[1] ?? ''))
+
+const renderButton = (recordingModes: ExperimentRecordingModes): HTMLElement => {
+ const { container } = render(
+ <VariantRecordingsButton
+ experiment={experiment}
+ metric={metric}
+ variantKey="test"
+ isBaseline={false}
+ surface="inline"
+ modes={recordingModes}
+ />
+ )
+ return container
+}
+
describe('VariantRecordingsButton', () => {
+ // Every link here is a `Link`, which routes client-side, so the router has to be mounted or the
+ // click throws instead of navigating.
+ beforeEach(() => {
+ initKeaTests(false)
+ router.mount()
+ })
+
it.each([
{
case: 'a metric the tab accepts links straight to its default population',
modes: modes({}),
- expectedHref: expect.stringContaining('metric_filter=fired_all'),
- expectedDisabled: 'false',
+ expectedParams: {
+ tab: 'recordings',
+ variant: 'test',
+ metric_uuid: 'metric-mean',
+ metric_filter: 'fired_all',
+ entry: 'results_button',
+ },
},
{
- // Without this the one click opens the variant's whole list under a label that promises
- // the metric's population, which is the question the row was asked.
- case: 'a metric the tab would drop disables the one-click link',
- modes: modes({
- metricSelectable: false,
- unselectableReason: 'Retention metrics cannot be matched to recordings.',
- defaultMode: null,
- }),
- expectedHref: null,
- expectedDisabled: 'true',
+ // A refused click left the row a dead control, so the fallback opens the variant's whole
+ // list and hands the tab the reason its metric filter is missing.
+ case: 'a metric the tab would drop opens every recording of the variant, with the reason',
+ modes: droppedMetricModes(),
+ expectedParams: {
+ tab: 'recordings',
+ variant: 'test',
+ entry: 'results_button',
+ metric_unavailable: 'retention',
+ },
},
- ])('$case', ({ modes: recordingModes, expectedHref, expectedDisabled }) => {
- const { container } = render(
- <VariantRecordingsButton
- experiment={experiment}
- metric={metric}
- variantKey="test"
- isBaseline={false}
- surface="inline"
- modes={recordingModes}
- />
- )
+ ])('$case', ({ modes: recordingModes, expectedParams }) => {
+ const container = renderButton(recordingModes)
const button = container.querySelector('[data-attr="experiment-metrics-view-recordings"]')
- expect(button?.getAttribute('aria-disabled')).toEqual(expectedDisabled)
- expect(button?.getAttribute('href')).toEqual(expectedHref)
+ expect(button?.getAttribute('aria-disabled')).toEqual('false')
+ expect(linkParams(button)).toEqual(expectedParams)
// The caret keeps offering the variant's whole list, named, even when the metric is dropped.
expect(container.querySelector('[data-attr="experiment-metrics-recordings-menu"]')).not.toBeNull()
})
+
+ it('keeps the metric modes refused in the menu, and explains nothing the menu already names', async () => {
+ // The two metric modes name a population the tab can't produce for this metric, so they stay
+ // refused. "All recordings of this variant" says what it opens, so the tab must not caption
+ // it with an explanation the reader never asked for, and the report must not count it as a
+ // filter taken away.
+ const captureSpy = jest.spyOn(posthog, 'capture').mockReturnValue(undefined as any)
+ const container = renderButton(droppedMetricModes())
+
+ await userEvent.click(container.querySelector('[data-attr="experiment-metrics-recordings-menu"]')!)
+
+ const item = (mode: string): Element | null =>
+ document.querySelector(`[data-attr="experiment-metrics-recordings-menu-${mode}"]`)
+ expect(item('fired_all')?.getAttribute('aria-disabled')).toEqual('true')
+ expect(item('no_metric_activity')?.getAttribute('aria-disabled')).toEqual('true')
+ expect(linkParams(item('all'))).toEqual({ tab: 'recordings', variant: 'test', entry: 'results_menu' })
+
+ await userEvent.click(item('all')!)
+ expect(captureSpy).toHaveBeenLastCalledWith(
+ 'viewed recordings from experiment',
+ expect.objectContaining({ trigger: 'menu', metric_unavailable_reason: null })
+ )
+ })
})
diff --git a/frontend/src/scenes/experiments/MetricsView/new/VariantRecordingsButton.tsx b/frontend/src/scenes/experiments/MetricsView/new/VariantRecordingsButton.tsx
index 746201a31975..e2651086895a 100644
--- a/frontend/src/scenes/experiments/MetricsView/new/VariantRecordingsButton.tsx
+++ b/frontend/src/scenes/experiments/MetricsView/new/VariantRecordingsButton.tsx
@@ -32,6 +32,9 @@ export interface VariantRecordingsButtonProps {
* The recordings link on a variant row: one click opens the Recordings tab on the metric's default
* population, and the caret offers the other populations plus every recording of the variant.
*
+ * When the tab cannot select the metric there is no default population, so the one click opens
+ * every recording of the variant and carries the reason for the tab to explain.
+ *
* The tab scopes its list per person through the experiment's exposure, so no link here needs an
* exposure filter of its own.
*/
@@ -43,7 +46,7 @@ export function VariantRecordingsButton({
surface,
modes,
}: VariantRecordingsButtonProps): JSX.Element {
- const { metricSelectable, unselectableReason, defaultMode, menuItems } = modes
+ const { metricSelectable, unselectableReason, unselectableCode, defaultMode, menuItems } = modes
// A metric the tab would drop must not reach the URL, or the list would answer without the
// filter the label promised.
const metricUuid = metricSelectable ? (metric.uuid ?? null) : null
@@ -57,6 +60,10 @@ export function VariantRecordingsButton({
metricUuid: metricFilterMode === null ? null : metricUuid,
metricFilterMode,
entry,
+ // Only the one-click fallback needs it. A menu item named "All recordings of this
+ // variant" already says what it opens, so an explanation there would answer a question
+ // the reader did not ask.
+ metricUnavailable: entry === 'results_button' ? unselectableCode : null,
})
const trackClick = (
@@ -71,6 +78,11 @@ export function VariantRecordingsButton({
trigger,
surface,
is_baseline: isBaseline,
+ // Null on an ordinary click. Non-null means the metric filter was dropped and the link
+ // opened the variant's whole list instead, which is the population this measures. The
+ // menu reports null even for the same metric: its "all recordings" item is a choice the
+ // viewer made, not a filter taken away, and the tab's own events count it the same way.
+ metric_unavailable_reason: trigger === 'button' ? unselectableCode : null,
})
}
@@ -80,10 +92,7 @@ export function VariantRecordingsButton({
type="secondary"
truncate
icon={<IconRewindPlay />}
- tooltip="Watch recordings of this variant on the Recordings tab."
- // Without a default mode the one click would open the variant's whole list under a
- // label that promises the metric's population. The caret still offers that list, named.
- disabledReason={defaultMode === null ? unselectableReason : null}
+ tooltip={unselectableReason ?? 'Watch recordings of this variant on the Recordings tab.'}
to={linkTo(defaultMode, 'results_button')}
data-attr="experiment-metrics-view-recordings"
onClick={() => trackClick(defaultMode, 'button')}
diff --git a/frontend/src/scenes/experiments/stories/ExperimentRecordingsListEmpty.stories.tsx b/frontend/src/scenes/experiments/stories/ExperimentRecordingsListEmpty.stories.tsx
index 0ff152da9dd5..bb35d5a1bfbd 100644
--- a/frontend/src/scenes/experiments/stories/ExperimentRecordingsListEmpty.stories.tsx
+++ b/frontend/src/scenes/experiments/stories/ExperimentRecordingsListEmpty.stories.tsx
@@ -169,6 +169,32 @@ export const ExperimentRecordingsEmptyMetricFilterFailed: Story = {
play: pickFiredNone,
}
+// A results-row link for a metric the tab can't select. It carries no metric and no mode, so the
+// caption strip is the only thing that says the list is every recording of the variant, and why.
+const DROPPED_METRIC_URL = `${urls.experiment(EXPERIMENT_WITH_FUNNEL_METRIC.id)}?tab=recordings&variant=test-1&entry=results_button&metric_unavailable=server_side_events`
+const DROPPED_METRIC_CAPTION = '[data-attr="experiment-recordings-dropped-metric-caption"]'
+
+export const ExperimentRecordingsDroppedMetric: Story = {
+ parameters: {
+ pageUrl: DROPPED_METRIC_URL,
+ testOptions: { waitForSelector: DROPPED_METRIC_CAPTION },
+ },
+}
+
+/**
+ * The ~520px of scene a nav sidebar and an open side panel leave. The caption is a long sentence,
+ * so this is where it has to wrap rather than clip.
+ */
+export const ExperimentRecordingsDroppedMetricNarrow: Story = {
+ parameters: {
+ pageUrl: DROPPED_METRIC_URL,
+ testOptions: {
+ waitForSelector: DROPPED_METRIC_CAPTION,
+ viewport: { width: 767, height: 1200 },
+ },
+ },
+}
+
/**
* The same matched-nothing state, reached by a results-row link rather than by hand. This is the
* one place the whole deep link runs end to end: the scene keeps the params through its first URL
diff --git a/frontend/src/scenes/experiments/stories/ExperimentResultsRowRecordingLinks.stories.tsx b/frontend/src/scenes/experiments/stories/ExperimentResultsRowRecordingLinks.stories.tsx
index b654cf51d45a..3140dc217492 100644
--- a/frontend/src/scenes/experiments/stories/ExperimentResultsRowRecordingLinks.stories.tsx
+++ b/frontend/src/scenes/experiments/stories/ExperimentResultsRowRecordingLinks.stories.tsx
@@ -109,6 +109,25 @@ export const ExperimentResultsRowRecordingLinksMeanMenu: Story = {
play: openFirstRowMenu,
}
+/**
+ * A metric the Recordings tab can't select: the button stays usable and opens every recording of
+ * the variant, while the two modes that name the metric's population stay refused. The menu is open
+ * because the button itself looks the same either way, so this is the only state a screenshot
+ * separates.
+ */
+export const ExperimentResultsRowRecordingLinksUnselectableMetric: Story = {
+ parameters: { pageUrl: urls.experiment(EXPERIMENT_WITH_MEAN_METRIC.id) },
+ decorators: [
+ meanMetricDecorator,
+ mswDecorator({
+ // The metric's only event has never been seen with a session id, which is what makes it
+ // unselectable on the tab.
+ get: { '/api/projects/:team_id/property_definitions/seen_together': { $pageview: false } },
+ }),
+ ],
+ play: openFirstRowMenu,
+}
+
/**
* The ~520px of scene a nav sidebar and an open side panel leave, where the button has to hold its
* column rather than push the rest of the table out of reach.
diff --git a/frontend/src/scenes/experiments/utils.ts b/frontend/src/scenes/experiments/utils.ts
index 1c18f027d56f..a34c8540690e 100644
--- a/frontend/src/scenes/experiments/utils.ts
+++ b/frontend/src/scenes/experiments/utils.ts
@@ -304,6 +304,12 @@ export const RETENTION_UNLINKABLE_REASON =
export const DATA_WAREHOUSE_UNLINKABLE_REASON =
'This metric is measured entirely in the data warehouse, which has no session events to match recordings on.'
+/**
+ * Why a metric cannot narrow a recordings list, as a value telemetry can count. The prose the
+ * viewer reads is derived from this, so a copy change can never shift what a report measures.
+ */
+export type ExperimentMetricUnlinkableCode = 'server_side_events' | 'retention' | 'data_warehouse'
+
/**
* Why a metric can't narrow a recordings list, or null when it can. A metric is unlinkable when
* every one of its sources is a never-session-linked event, or when it yields no session filter at
@@ -311,16 +317,31 @@ export const DATA_WAREHOUSE_UNLINKABLE_REASON =
* only match zero sessions. Pass an empty `unlinkableEventNames` while the linkability check loads,
* which fails open, the posture every linkability consumer shares.
*/
-export function getMetricUnlinkableReason(metric: ExperimentMetric, unlinkableEventNames: Set<string>): string | null {
+export function getMetricUnlinkableCode(
+ metric: ExperimentMetric,
+ unlinkableEventNames: Set<string>
+): ExperimentMetricUnlinkableCode | null {
const filters = getMetricSessionFilters(metric)
if (filters.length === 0) {
- return isExperimentRetentionMetric(metric) ? RETENTION_UNLINKABLE_REASON : DATA_WAREHOUSE_UNLINKABLE_REASON
+ return isExperimentRetentionMetric(metric) ? 'retention' : 'data_warehouse'
}
return filters.every((filter) => isUnlinkableEventFilter(filter, unlinkableEventNames))
- ? METRIC_UNLINKABLE_REASON
+ ? 'server_side_events'
: null
}
+const METRIC_UNLINKABLE_REASONS: Record<ExperimentMetricUnlinkableCode, string> = {
+ server_side_events: METRIC_UNLINKABLE_REASON,
+ retention: RETENTION_UNLINKABLE_REASON,
+ data_warehouse: DATA_WAREHOUSE_UNLINKABLE_REASON,
+}
+
+/** The prose for `getMetricUnlinkableCode`, as the tab's own metric dropdown reads it. */
+export function getMetricUnlinkableReason(metric: ExperimentMetric, unlinkableEventNames: Set<string>): string | null {
+ const code = getMetricUnlinkableCode(metric, unlinkableEventNames)
+ return code === null ? null : METRIC_UNLINKABLE_REASONS[code]
+}
+
/**
* The single event an experiment's exposure is counted on, for the session-linkability check.
* Null for an action exposure config, which can match several events, so no one name applies.