: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(marketing): bypass welcome for the new dashboard (#99533)
Javier Bahamondes035089227761
diff --git a/docs/internal/marketing-analytics-configuration-writes.md b/docs/internal/marketing-analytics-configuration-writes.mdindex c63c5422ba76..fea395b6787c 100644--- a/docs/internal/marketing-analytics-configuration-writes.md+++ b/docs/internal/marketing-analytics-configuration-writes.md@@ -28,4 +28,8 @@ The new dashboard embeds the existing Attribution explorer as Conversion when `mThe new dashboard also embeds the existing Retention explorer when `marketing-analytics-retention` is enabled. It shares the acquisition date range and keeps the explorer’s cohort controls, reload and empty state. Previous-period comparison and the traffic test-account filter do not apply to Retention.+With `new-marketing-analytics-dashboard` enabled, Marketing Analytics opens directly without the product welcome screen or its setup reminder. Existing setup status and local skip preferences remain unchanged; disabling the flag restores the previous onboarding behavior. Configuration remains available in Setup.++The bypass waits for feature flags before mounting setup detection. The explicit `?empty_state` preview still takes precedence.+With `new-marketing-analytics-dashboard` enabled, Ad performance reuses the existing ad spend dashboard. Its conversion-goal switch appears only when goals are configured and defaults to on. Turning it off limits the summary and table queries to ad-platform metrics, including platform-reported conversions, and omits saved and draft PostHog conversion goals. This preference applies only to Ad performance; leaving the tab or disabling the dashboard flag restores the legacy queries and saved column choices. Ad performance keeps source status and reconnect controls visible when loading sources fails, without entering legacy onboarding.diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.test.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.test.tsxindex dddfd4d26e70..b654c70ab4fa 100644--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.test.tsx+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.test.tsx@@ -1,7 +1,9 @@-import { cleanup, render, screen } from '@testing-library/react'+import { act, cleanup, render, screen } from '@testing-library/react'import { kea, path } from 'kea'import { router } from 'kea-router'+import { FEATURE_FLAGS } from 'lib/constants'+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { sceneLogic } from 'scenes/sceneLogic'import { Scene } from 'scenes/sceneTypes'@@ -11,7 +13,7 @@ import { initKeaTests } from '~/test/init'import { ProductEmptyStateGate } from './ProductEmptyStateGate'import { productSetupStatusLogic } from './productSetupStatusLogic'-import type { ProductEmptyStateConfig, SceneProductEmptyState } from './types'+import type { ProductEmptyStateConfig, ProductSetupStatus, SceneProductEmptyState } from './types'const config: ProductEmptyStateConfig = {productKey: ProductKey.EXPERIMENTS,@@ -54,6 +56,61 @@ describe('ProductEmptyStateGate', () => {afterEach(() => cleanup())+ it.each<ProductSetupStatus>(['loading', 'needs-setup', 'waiting-for-data'])(+ 'bypasses %s only while the configured flag is enabled',+ (status) => {+ const setup = productSetupStatusLogic({ productKey: ProductKey.EXPERIMENTS })+ setup.actions.setDetectedStatus('loading')+ setup.actions.setDetectedStatus(status)+ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.MARKETING_ANALYTICS_NEW_DASHBOARD]: true })+ const { rerender } = render(+ <ProductEmptyStateGate+ emptyState={{ ...emptyState, bypassFeatureFlag: FEATURE_FLAGS.MARKETING_ANALYTICS_NEW_DASHBOARD }}+ >+ <div>the real scene</div>+ </ProductEmptyStateGate>+ )+ expect(screen.getByText('the real scene')).not.toBeNull()+ expect(noopStatusLogic.findMounted()).toBeNull()+ expect(setup.values.skipped).toBe(false)+ expect(setup.values.status).toBe(status)+ act(() => featureFlagLogic.actions.setFeatureFlags([], {}))+ expect(screen.queryByText('the real scene')).toBeNull()+ expect(noopStatusLogic.findMounted()).not.toBeNull()+ expect(setup.values.skipped).toBe(false)+ act(() =>+ featureFlagLogic.actions.setFeatureFlags([], {+ [FEATURE_FLAGS.MARKETING_ANALYTICS_NEW_DASHBOARD]: true,+ })+ )+ rerender(+ <ProductEmptyStateGate emptyState={emptyState}>+ <div>the real scene</div>+ </ProductEmptyStateGate>+ )+ expect(screen.queryByText('the real scene')).toBeNull()+ }+ )++ it('waits for the bypass flag before mounting detection', () => {+ productSetupStatusLogic({ productKey: ProductKey.EXPERIMENTS }).actions.setDetectedStatus('needs-setup')+ render(+ <ProductEmptyStateGate+ emptyState={{ ...emptyState, bypassFeatureFlag: FEATURE_FLAGS.MARKETING_ANALYTICS_NEW_DASHBOARD }}+ >+ <div>the real scene</div>+ </ProductEmptyStateGate>+ )+ expect(noopStatusLogic.findMounted()).toBeNull()+ expect(screen.queryByText('Set up experiments')).toBeNull()+ expect(screen.queryByText('the real scene')).toBeNull()+ act(() =>+ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.MARKETING_ANALYTICS_NEW_DASHBOARD]: true })+ )+ expect(screen.getByText('the real scene')).not.toBeNull()+ expect(noopStatusLogic.findMounted()).toBeNull()+ })+// `?empty_state` exists so anyone can review the setup screen on a project that already// has data. Matching it too loosely would hide a real scene from a normal URL, so the// off cases matter as much as the on ones.@@ -64,10 +121,13 @@ describe('ProductEmptyStateGate', () => {['?empty_state=0', false],['', false],])('renders the setup screen for %s: %s', (search, expectedForced) => {+ featureFlagLogic.actions.setFeatureFlags([], { [FEATURE_FLAGS.MARKETING_ANALYTICS_NEW_DASHBOARD]: true })router.actions.push(`/experiments${search}`)render(- <ProductEmptyStateGate emptyState={emptyState}>+ <ProductEmptyStateGate+ emptyState={{ ...emptyState, bypassFeatureFlag: FEATURE_FLAGS.MARKETING_ANALYTICS_NEW_DASHBOARD }}+ ><div>the real scene</div></ProductEmptyStateGate>)diff --git a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsx b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsxindex 25a38baa25d0..2f5a5394747c 100644--- a/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsx+++ b/frontend/src/lib/components/ProductEmptyState/ProductEmptyStateGate.tsx@@ -69,7 +69,9 @@ export interface ProductEmptyStateGateProps {* so the screen can be reviewed on a project that already has data.*/export function ProductEmptyStateGate({ emptyState, params, children }: ProductEmptyStateGateProps): JSX.Element {- const { featureFlags } = useValues(featureFlagLogic)+ const { featureFlags, receivedFeatureFlags } = useValues(featureFlagLogic)+ const { searchParams } = useValues(router)+ const forcedMode = forcedModeFromParam(searchParams[EMPTY_STATE_PARAM])const { activeSceneId } = useValues(sceneLogic)// When the empty state is flag-gated or scoped to specific scenes or tabs, stay a strict@@ -83,6 +85,16 @@ export function ProductEmptyStateGate({ emptyState, params, children }: ProductE) {return <>{children}</>}+ if (emptyState.bypassFeatureFlag && !receivedFeatureFlags && !forcedMode) {+ return (+ <ProductSceneFrame config={emptyState.config}>+ <SpinnerOverlay sceneLevel />+ </ProductSceneFrame>+ )+ }+ if (emptyState.bypassFeatureFlag && featureFlags[emptyState.bypassFeatureFlag] && !forcedMode) {+ return <>{children}</>+ }return <ProductEmptyStateGateInner emptyState={emptyState}>{children}</ProductEmptyStateGateInner>}diff --git a/frontend/src/lib/components/ProductEmptyState/types.ts b/frontend/src/lib/components/ProductEmptyState/types.tsindex 5a1c55846213..03c4613f8355 100644--- a/frontend/src/lib/components/ProductEmptyState/types.ts+++ b/frontend/src/lib/components/ProductEmptyState/types.ts@@ -179,6 +179,7 @@ export interface SceneProductEmptyState {* roll the empty state out gradually.*/featureFlag?: FeatureFlagKey+ bypassFeatureFlag?: FeatureFlagKey/*** Only gate these surfaces, for a scene module that serves more than one. Omit to gate* every scene the module serves.diff --git a/products/marketing_analytics/frontend/emptyState/marketingAnalyticsEmptyState.tsx b/products/marketing_analytics/frontend/emptyState/marketingAnalyticsEmptyState.tsxindex 502f272e2c39..38a1153e707e 100644--- a/products/marketing_analytics/frontend/emptyState/marketingAnalyticsEmptyState.tsx+++ b/products/marketing_analytics/frontend/emptyState/marketingAnalyticsEmptyState.tsx@@ -17,6 +17,7 @@ export const marketingAnalyticsEmptyState: SceneProductEmptyState = {statusLogic: marketingAnalyticsSetupLogic,// The whole product is behind this flag; its in-scene banner handles the flag-off case.featureFlag: FEATURE_FLAGS.WEB_ANALYTICS_MARKETING,+ bypassFeatureFlag: FEATURE_FLAGS.MARKETING_ANALYTICS_NEW_DASHBOARD,config: {productKey: ProductKey.MARKETING_ANALYTICS,productName: 'Marketing analytics',