: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(experiments): keep a renamed action step in a funnel metric (#109430)
Ben Lea6df145744046
diff --git a/frontend/src/scenes/experiments/metricQueryUtils.test.ts b/frontend/src/scenes/experiments/metricQueryUtils.test.tsindex 0994076e4f0e..3339158083a6 100644--- a/frontend/src/scenes/experiments/metricQueryUtils.test.ts+++ b/frontend/src/scenes/experiments/metricQueryUtils.test.ts@@ -230,19 +230,41 @@ describe('filterToMetricSource', () => {describe('filterToMetricConfig', () => {it('returns FUNNEL metric config when funnel type is provided', () => {const events = [- { id: 'step1', properties: [], order: 0 },- { id: 'step2', properties: [], order: 1 },+ { id: 'step1', custom_name: 'Signed up', properties: [], order: 0 },+ { id: 'step2', custom_name: '', properties: [], order: 1 },+ ]+ const actions = [{ id: 123, name: 'action1', custom_name: 'Activated', properties: [], order: 2 }]+ const dataWarehouse = [+ {+ id: 'stripe_charges',+ name: 'Stripe charges',+ custom_name: 'Paid',+ timestamp_field: 'created_at',+ events_join_key: 'distinct_id',+ data_warehouse_join_key: 'customer_id',+ properties: [],+ order: 3,+ },]- const actions = [{ id: 123, name: 'action1', properties: [], order: 2 }]- const result = filterToMetricConfig(ExperimentMetricType.FUNNEL, actions, events, undefined)+ const result = filterToMetricConfig(ExperimentMetricType.FUNNEL, actions, events, dataWarehouse)expect(result).toEqual({metric_type: ExperimentMetricType.FUNNEL,series: [- { kind: NodeKind.EventsNode, event: 'step1', properties: [] },+ { kind: NodeKind.EventsNode, event: 'step1', custom_name: 'Signed up', properties: [] },{ kind: NodeKind.EventsNode, event: 'step2', properties: [] },- { kind: NodeKind.ActionsNode, id: 123, name: 'action1', properties: [] },+ { kind: NodeKind.ActionsNode, id: 123, name: 'action1', custom_name: 'Activated', properties: [] },+ {+ kind: NodeKind.ExperimentDataWarehouseNode,+ table_name: 'stripe_charges',+ name: 'Stripe charges',+ custom_name: 'Paid',+ timestamp_field: 'created_at',+ events_join_key: 'distinct_id',+ data_warehouse_join_key: 'customer_id',+ properties: [],+ },],})})diff --git a/frontend/src/scenes/experiments/metricQueryUtils.ts b/frontend/src/scenes/experiments/metricQueryUtils.tsindex fd619522cafe..8604be337fa2 100644--- a/frontend/src/scenes/experiments/metricQueryUtils.ts+++ b/frontend/src/scenes/experiments/metricQueryUtils.ts@@ -417,7 +417,7 @@ export function filterToMetricConfig(({kind: NodeKind.EventsNode,event: event.id,- custom_name: event.custom_name,+ custom_name: event.custom_name || undefined,properties: event.properties,order: event.order,}) as EventsNode & { order?: number }@@ -430,6 +430,7 @@ export function filterToMetricConfig(kind: NodeKind.ActionsNode,id: action.id,name: action.name,+ custom_name: action.custom_name || undefined,properties: action.properties,order: action.order,}) as ActionsNode & { order?: number }@@ -445,7 +446,7 @@ export function filterToMetricConfig(timestamp_field: dataWarehouse.timestamp_field,events_join_key: dataWarehouse.events_join_key,data_warehouse_join_key: dataWarehouse.data_warehouse_join_key,- custom_name: dataWarehouse.custom_name,+ custom_name: dataWarehouse.custom_name || undefined,properties: dataWarehouse.properties,order: dataWarehouse.order,}) as ExperimentDataWarehouseNode & { order?: number }