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(onboarding): land users on home after onboarding, not product pages (#129190)

Fernando Gomesa0e00f3b43f9
diff --git a/frontend/src/scenes/onboarding/onboardingLogic.test.ts b/frontend/src/scenes/onboarding/onboardingLogic.test.ts
index 6cf0fec222d5..c2816623a097 100644
--- a/frontend/src/scenes/onboarding/onboardingLogic.test.ts
+++ b/frontend/src/scenes/onboarding/onboardingLogic.test.ts
@@ -4,6 +4,7 @@ import { expectLogic } from 'kea-test-utils'
import { SetupTaskId } from 'lib/components/ProductSetup'
import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { removeProjectIdIfPresent } from 'lib/utils/kea-router'
import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
@@ -653,35 +654,19 @@ describe('onboardingLogic — flow composition', () => {
})
describe('completion redirect URL', () => {
- // Each entry: [primary, expected redirect path-substring].
- // Verifies that each per-product provider's `completeRedirectUrl` is wired up.
- // EXPERIMENTS intentionally falls through to urls.default() — same behaviour as
- // the original central switch.
- const cases: Array<[ProductKey, RegExp]> = [
- [ProductKey.PRODUCT_ANALYTICS, /quickstart|insight/i],
- [ProductKey.WEB_ANALYTICS, /web/i],
- [ProductKey.SESSION_REPLAY, /replay/i],
- [ProductKey.FEATURE_FLAGS, /feature-flags/i],
- [ProductKey.SURVEYS, /survey/i],
- [ProductKey.ERROR_TRACKING, /error-tracking/i],
- [ProductKey.AI_OBSERVABILITY, /ai-observability/i],
- [ProductKey.WORKFLOWS, /workflow/i],
- [ProductKey.LOGS, /log/i],
- [ProductKey.DATA_WAREHOUSE, /sources|data-management/i],
- [ProductKey.CONVERSATIONS, /support/i],
- ]
-
- it.each(cases)('%s lands on a product-specific page', (product, pattern) => {
- logic.actions.setProductKey(product)
- expect(logic.values.onCompleteOnboardingRedirectUrl).toMatch(pattern)
- })
-
- it('experiments falls through to urls.default()', () => {
- logic.actions.setProductKey(ProductKey.EXPERIMENTS)
- expect(logic.values.onCompleteOnboardingRedirectUrl).toBe('/')
- })
+ // Post-onboarding landing is one central decision, not per-product. In the default flow
+ // every product goes home, so the product the user onboarded must not change the target.
+ // The simplified-onboarding welcome page is the only other destination, covered under
+ // 'flow variants'.
+ it.each([ProductKey.PRODUCT_ANALYTICS, ProductKey.SESSION_REPLAY, ProductKey.EXPERIMENTS])(
+ '%s lands on the homepage in the default flow',
+ (product) => {
+ logic.actions.setProductKey(product)
+ expect(logic.values.onCompleteOnboardingRedirectUrl).toBe(urls.projectHomepage())
+ }
+ )
- it('redirect override takes precedence over the per-product URL', () => {
+ it('redirect override takes precedence over the homepage', () => {
logic.actions.setProductKey(ProductKey.WEB_ANALYTICS)
logic.actions.setOnCompleteOnboardingRedirectUrl('/custom-target')
expect(logic.values.onCompleteOnboardingRedirectUrl).toBe('/custom-target')
@@ -694,13 +679,13 @@ describe('onboardingLogic — flow composition', () => {
logic.actions.updateCurrentTeamSuccess(completed as any, completed as any)
}
- it('redirects to the product once onboarding completes', async () => {
+ it('redirects home once onboarding completes', async () => {
router.actions.push(urls.default())
logic.actions.setProductKey(ProductKey.PRODUCT_ANALYTICS)
await expectLogic(logic, () => {
completeProduct()
}).toFinishAllListeners()
- expect(router.values.location.pathname).toMatch(/quickstart|insight/i)
+ expect(removeProjectIdIfPresent(router.values.location.pathname)).toBe(urls.projectHomepage())
})
})
diff --git a/frontend/src/scenes/onboarding/onboardingLogic.tsx b/frontend/src/scenes/onboarding/onboardingLogic.tsx
index 3b90f769c897..71be2c065796 100644
--- a/frontend/src/scenes/onboarding/onboardingLogic.tsx
+++ b/frontend/src/scenes/onboarding/onboardingLogic.tsx
@@ -217,10 +217,7 @@ export interface onboardingLogicMeta {
currentStepProductKey: ProductKey | null,
secondaryProductKeys: ProductKey[]
) => string
- onCompleteOnboardingRedirectUrl: (
- productKey: ProductKey | null,
- onCompleteOnboardingRedirectUrlOverride: string | null
- ) => string
+ onCompleteOnboardingRedirectUrl: (onCompleteOnboardingRedirectUrlOverride: string | null) => string
}
}
@@ -650,16 +647,16 @@ export const onboardingLogic = kea<onboardingLogicType>([
}).url
},
],
+ // Single decision point for where a user lands after onboarding completes or is skipped.
+ // An explicit `?next=` override wins, and everything else goes home. Products do not choose
+ // their own landing target.
onCompleteOnboardingRedirectUrl: [
- (s) => [s.productKey, s.onCompleteOnboardingRedirectUrlOverride],
- (productKey: ProductKey | null, onCompleteOnboardingRedirectUrlOverride: string | null): string => {
+ (s) => [s.onCompleteOnboardingRedirectUrlOverride],
+ (onCompleteOnboardingRedirectUrlOverride: string | null): string => {
if (onCompleteOnboardingRedirectUrlOverride) {
return onCompleteOnboardingRedirectUrlOverride
}
- if (!productKey) {
- return urls.default()
- }
- return onboardingProviderRegistry[productKey]?.completeRedirectUrl?.() ?? urls.default()
+ return urls.projectHomepage()
},
],
}),
diff --git a/frontend/src/scenes/onboarding/stepProviderRegistry.test.ts b/frontend/src/scenes/onboarding/stepProviderRegistry.test.ts
index f89e4b52d897..b4b80a339f7a 100644
--- a/frontend/src/scenes/onboarding/stepProviderRegistry.test.ts
+++ b/frontend/src/scenes/onboarding/stepProviderRegistry.test.ts
@@ -27,7 +27,7 @@ describe('onboardingProviderRegistry', () => {
expect(Object.keys(onboardingProviderRegistry).sort()).toEqual(Object.keys(availableOnboardingProducts).sort())
})
- it('sends metrics through an install step and lands on the metrics scene', () => {
+ it('sends metrics through a single install step', () => {
const provider = onboardingProviderRegistry[ProductKey.METRICS]
const steps = provider!.steps(context(ProductKey.METRICS))
@@ -35,7 +35,6 @@ describe('onboardingProviderRegistry', () => {
expect(steps).toHaveLength(1)
expect(steps[0].productKey).toBe(ProductKey.METRICS)
expect(steps[0].stepKey).toBe(OnboardingStepKey.INSTALL)
- expect(provider!.completeRedirectUrl?.()).toBe('/metrics')
})
// Metrics and Logs both arrive over OTel, but their install experiences differ:
diff --git a/frontend/src/scenes/onboarding/stepProviderRegistry.ts b/frontend/src/scenes/onboarding/stepProviderRegistry.ts
index cd3b2182e061..3029ef84ea69 100644
--- a/frontend/src/scenes/onboarding/stepProviderRegistry.ts
+++ b/frontend/src/scenes/onboarding/stepProviderRegistry.ts
@@ -20,8 +20,7 @@ import { type ProductOnboardingProvider } from './types'
/**
* Registry of per-product onboarding providers. The flow selector iterates
* `selectedProducts` in order and concatenates each provider's `steps(ctx)`
- * into a single flat flow. The primary product's `completeRedirectUrl()` is
- * used as the post-onboarding landing target.
+ * into a single flat flow.
*
* Adding a product to the onboarding system: write a provider in
* `products/<name>/frontend/onboarding/steps.tsx`, register it here, and add
diff --git a/frontend/src/scenes/onboarding/types.ts b/frontend/src/scenes/onboarding/types.ts
index 94b430eae595..f1c6a9b857b5 100644
--- a/frontend/src/scenes/onboarding/types.ts
+++ b/frontend/src/scenes/onboarding/types.ts
@@ -76,23 +76,16 @@ export type StepProvider = (ctx: OnboardingFlowContext) => OnboardingStepDescrip
/**
* Per-product registration unit for the onboarding system. Wires a product into
- * the flow with everything the central machinery needs to know:
+ * the flow via `steps`: how to build the product's contribution to the flow.
*
- * - `steps`: how to build the product's contribution to the flow.
- * - `completeRedirectUrl`: where to send the user after their onboarding for
- * this product completes (was previously a central switch in onboardingLogic).
+ * Adding a product is a single-file change inside
+ * `products/<name>/frontend/onboarding/steps.tsx` plus a registry entry.
*
- * Co-locating both here means adding a product is a single-file change inside
- * `products/<name>/frontend/onboarding/steps.tsx` plus a registry entry — no
- * scattered switches to keep in sync.
+ * Post-onboarding redirection is not a per-product decision: `onboardingLogic`
+ * owns it centrally (see `onCompleteOnboardingRedirectUrl`).
*/
export interface ProductOnboardingProvider {
steps: StepProvider
- /**
- * Where to redirect when this product's onboarding completes (used when this
- * product is the primary). Falls back to the homepage if not provided.
- */
- completeRedirectUrl?: () => string
}
/**
diff --git a/products/ai_observability/frontend/onboarding/steps.tsx b/products/ai_observability/frontend/onboarding/steps.tsx
index 67448d3f28a4..ea42e8e2b61a 100644
--- a/products/ai_observability/frontend/onboarding/steps.tsx
+++ b/products/ai_observability/frontend/onboarding/steps.tsx
@@ -12,7 +12,6 @@ import { OpenAILogo } from 'scenes/onboarding/shared/logos/OpenAILogo'
import { OpenRouterLogo } from 'scenes/onboarding/shared/logos/OpenRouterLogo'
import type { WizardBadgeItem } from 'scenes/onboarding/shared/wizard-command/WizardModeShell'
import { type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
@@ -62,5 +61,4 @@ export const aiObservabilityOnboarding: ProductOnboardingProvider = {
),
},
],
- completeRedirectUrl: () => urls.aiObservabilityDashboard(),
}
diff --git a/products/conversations/frontend/onboarding/steps.tsx b/products/conversations/frontend/onboarding/steps.tsx
index daa3abc97afa..e9bda26f3ed0 100644
--- a/products/conversations/frontend/onboarding/steps.tsx
+++ b/products/conversations/frontend/onboarding/steps.tsx
@@ -1,5 +1,4 @@
import { type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
// Support has no product-specific onboarding screen worth showing: enabling the product and
// configuring channels both live in Support settings. `conversations_enabled` is flipped on
@@ -7,5 +6,4 @@ import { urls } from 'scenes/urls'
// just the shared trailing steps, then a redirect into the product.
export const conversationsOnboarding: ProductOnboardingProvider = {
steps: () => [],
- completeRedirectUrl: () => urls.supportTickets(),
}
diff --git a/products/data_warehouse/frontend/onboarding/steps.tsx b/products/data_warehouse/frontend/onboarding/steps.tsx
index 2265db224ad0..2f4b395dd0ac 100644
--- a/products/data_warehouse/frontend/onboarding/steps.tsx
+++ b/products/data_warehouse/frontend/onboarding/steps.tsx
@@ -1,6 +1,5 @@
import { OnboardingDataWarehouseSourcesStep } from 'scenes/onboarding/data-warehouse/OnboardingDataWarehouseSourcesStep'
import { type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
@@ -15,8 +14,4 @@ export const dataWarehouseOnboarding: ProductOnboardingProvider = {
render: () => <OnboardingDataWarehouseSourcesStep />,
},
],
- // Land freshly-onboarded users on the sources list — where they can connect or manage a
- // source — instead of falling through to urls.default() (the home page), which drops the
- // data-warehouse intent on the floor. Every other product redirects to its own surface.
- completeRedirectUrl: () => urls.sources(),
}
diff --git a/products/error_tracking/frontend/onboarding/steps.tsx b/products/error_tracking/frontend/onboarding/steps.tsx
index 1d5749bed377..4db1c1ab6279 100644
--- a/products/error_tracking/frontend/onboarding/steps.tsx
+++ b/products/error_tracking/frontend/onboarding/steps.tsx
@@ -7,7 +7,6 @@ import {
} from 'scenes/onboarding/sdks/error-tracking/ErrorTrackingSDKInstructions'
import { OnboardingInstallStep } from 'scenes/onboarding/sdks/OnboardingInstallStep'
import { INSTALL_DEDUP_KEYS, type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
@@ -54,5 +53,4 @@ export const errorTrackingOnboarding: ProductOnboardingProvider = {
},
]
},
- completeRedirectUrl: () => urls.errorTracking(),
}
diff --git a/products/experiments/frontend/onboarding/steps.tsx b/products/experiments/frontend/onboarding/steps.tsx
index b9db50215d3d..e0053982d3f9 100644
--- a/products/experiments/frontend/onboarding/steps.tsx
+++ b/products/experiments/frontend/onboarding/steps.tsx
@@ -5,8 +5,6 @@ import { INSTALL_DEDUP_KEYS, type ProductOnboardingProvider } from 'scenes/onboa
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
-// `completeRedirectUrl` intentionally omitted: experiments falls through to
-// urls.default() (no curated post-onboarding landing page yet).
export const experimentsOnboarding: ProductOnboardingProvider = {
steps: (ctx) => [
{
diff --git a/products/feature_flags/frontend/onboarding/steps.tsx b/products/feature_flags/frontend/onboarding/steps.tsx
index 89284ec7d821..7f8037ca662d 100644
--- a/products/feature_flags/frontend/onboarding/steps.tsx
+++ b/products/feature_flags/frontend/onboarding/steps.tsx
@@ -1,7 +1,6 @@
import { FeatureFlagsSDKInstructions } from 'scenes/onboarding/sdks/feature-flags/FeatureFlagsSDKInstructions'
import { OnboardingInstallStep } from 'scenes/onboarding/sdks/OnboardingInstallStep'
import { INSTALL_DEDUP_KEYS, type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
@@ -17,5 +16,4 @@ export const featureFlagsOnboarding: ProductOnboardingProvider = {
render: () => <OnboardingInstallStep sdkInstructionMap={FeatureFlagsSDKInstructions} />,
},
],
- completeRedirectUrl: () => urls.featureFlags(),
}
diff --git a/products/logs/frontend/onboarding/steps.tsx b/products/logs/frontend/onboarding/steps.tsx
index 4ccd0475fd81..b4becfbf4272 100644
--- a/products/logs/frontend/onboarding/steps.tsx
+++ b/products/logs/frontend/onboarding/steps.tsx
@@ -2,7 +2,6 @@ import { SetupTaskId } from 'lib/components/ProductSetup'
import { LogsSDKInstructions } from 'scenes/onboarding/sdks/logs/LogsSDKInstructions'
import { OnboardingInstallStep } from 'scenes/onboarding/sdks/OnboardingInstallStep'
import { INSTALL_DEDUP_KEYS, type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
@@ -21,5 +20,4 @@ export const logsOnboarding: ProductOnboardingProvider = {
render: () => <OnboardingInstallStep sdkInstructionMap={LogsSDKInstructions} hideInstallationCheck />,
},
],
- completeRedirectUrl: () => urls.logs(),
}
diff --git a/products/mcp_analytics/frontend/onboarding/steps.tsx b/products/mcp_analytics/frontend/onboarding/steps.tsx
index f6f292db55d9..fb8edc245162 100644
--- a/products/mcp_analytics/frontend/onboarding/steps.tsx
+++ b/products/mcp_analytics/frontend/onboarding/steps.tsx
@@ -5,7 +5,6 @@ import { onboardingLogic } from 'scenes/onboarding/onboardingLogic'
import { OnboardingStep } from 'scenes/onboarding/OnboardingStep'
import { availableOnboardingProducts } from 'scenes/onboarding/shared/utils'
import { type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
@@ -48,5 +47,4 @@ export const mcpAnalyticsOnboarding: ProductOnboardingProvider = {
render: () => <MCPAnalyticsInstallStep />,
},
],
- completeRedirectUrl: () => urls.mcpAnalytics(),
}
diff --git a/products/metrics/frontend/onboarding/steps.tsx b/products/metrics/frontend/onboarding/steps.tsx
index 7802cce2a492..9727d61bdfe1 100644
--- a/products/metrics/frontend/onboarding/steps.tsx
+++ b/products/metrics/frontend/onboarding/steps.tsx
@@ -1,7 +1,6 @@
import { MetricsSDKInstructions } from 'scenes/onboarding/sdks/metrics/MetricsSDKInstructions'
import { OnboardingInstallStep } from 'scenes/onboarding/sdks/OnboardingInstallStep'
import { type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
@@ -21,5 +20,4 @@ export const metricsOnboarding: ProductOnboardingProvider = {
render: () => <OnboardingInstallStep sdkInstructionMap={MetricsSDKInstructions} hideInstallationCheck />,
},
],
- completeRedirectUrl: () => urls.metrics(),
}
diff --git a/products/product_analytics/frontend/onboarding/steps.tsx b/products/product_analytics/frontend/onboarding/steps.tsx
index 97e7d3f7f12b..1d509a5ea632 100644
--- a/products/product_analytics/frontend/onboarding/steps.tsx
+++ b/products/product_analytics/frontend/onboarding/steps.tsx
@@ -11,7 +11,6 @@ import {
ProductAnalyticsSDKTagOverrides,
} from 'scenes/onboarding/sdks/product-analytics/ProductAnalyticsSDKInstructions'
import { INSTALL_DEDUP_KEYS, type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey, type TeamPublicType, type TeamType } from '~/types'
@@ -150,5 +149,4 @@ export const productAnalyticsOnboarding: ProductOnboardingProvider = {
},
]
},
- completeRedirectUrl: () => urls.insightQuickStart(),
}
diff --git a/products/session_replay/frontend/onboarding/steps.tsx b/products/session_replay/frontend/onboarding/steps.tsx
index 1cbd08c952ed..2d7eaf80aaf7 100644
--- a/products/session_replay/frontend/onboarding/steps.tsx
+++ b/products/session_replay/frontend/onboarding/steps.tsx
@@ -12,7 +12,6 @@ import {
import { INSTALL_DEDUP_KEYS, type ProductOnboardingProvider } from 'scenes/onboarding/types'
import { getMaskingConfigFromLevel, getMaskingLevelFromConfig } from 'scenes/session-recordings/utils'
import { teamLogic } from 'scenes/teamLogic'
-import { urls } from 'scenes/urls'
import { userLogic } from 'scenes/userLogic'
import { ProductKey } from '~/queries/schema/schema-general'
@@ -118,5 +117,4 @@ export const sessionReplayOnboarding: ProductOnboardingProvider = {
},
]
},
- completeRedirectUrl: () => urls.replay(),
}
diff --git a/products/surveys/frontend/onboarding/steps.tsx b/products/surveys/frontend/onboarding/steps.tsx
index d72bae6cdb0c..36070da0e1ba 100644
--- a/products/surveys/frontend/onboarding/steps.tsx
+++ b/products/surveys/frontend/onboarding/steps.tsx
@@ -1,7 +1,6 @@
import { OnboardingInstallStep } from 'scenes/onboarding/sdks/OnboardingInstallStep'
import { SurveysSDKInstructions } from 'scenes/onboarding/sdks/surveys/SurveysSDKInstructions'
import { INSTALL_DEDUP_KEYS, type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
@@ -17,5 +16,4 @@ export const surveysOnboarding: ProductOnboardingProvider = {
render: () => <OnboardingInstallStep sdkInstructionMap={SurveysSDKInstructions} />,
},
],
- completeRedirectUrl: () => urls.surveyWizard(),
}
diff --git a/products/web_analytics/frontend/onboarding/steps.tsx b/products/web_analytics/frontend/onboarding/steps.tsx
index 790dc26df3e3..efcba3236a74 100644
--- a/products/web_analytics/frontend/onboarding/steps.tsx
+++ b/products/web_analytics/frontend/onboarding/steps.tsx
@@ -7,7 +7,6 @@ import { WebAnalyticsSDKInstructions } from 'scenes/onboarding/sdks/web-analytic
import { INSTALL_DEDUP_KEYS, type ProductOnboardingProvider } from 'scenes/onboarding/types'
import { OnboardingWebAnalyticsAuthorizedDomainsStep } from 'scenes/onboarding/web-analytics/OnboardingWebAnalyticsAuthorizedDomainsStep'
import { OnboardingWebAnalyticsPathCleaningStep } from 'scenes/onboarding/web-analytics/OnboardingWebAnalyticsPathCleaningStep'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey, type TeamPublicType, type TeamType } from '~/types'
@@ -126,5 +125,4 @@ export const webAnalyticsOnboarding: ProductOnboardingProvider = {
},
]
},
- completeRedirectUrl: () => urls.webAnalytics(),
}
diff --git a/products/workflows/frontend/onboarding/steps.tsx b/products/workflows/frontend/onboarding/steps.tsx
index 5e9119edb585..bf0455da1ded 100644
--- a/products/workflows/frontend/onboarding/steps.tsx
+++ b/products/workflows/frontend/onboarding/steps.tsx
@@ -8,7 +8,6 @@ import {
} from 'scenes/onboarding/sdks/workflows/WorkflowsSDKInstructions'
import { useWizardCommand } from 'scenes/onboarding/shared/useWizardCommand'
import { type ProductOnboardingProvider } from 'scenes/onboarding/types'
-import { urls } from 'scenes/urls'
import { ProductKey } from '~/queries/schema/schema-general'
import { OnboardingStepKey } from '~/types'
@@ -73,5 +72,4 @@ export const workflowsOnboarding: ProductOnboardingProvider = {
),
},
],
- completeRedirectUrl: () => urls.workflows(),
}