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.

chore(marketing): remove the marketing source onboarding flag (#124925)

Javier Bahamondese8570b349a4f
diff --git a/docs/internal/marketing-source-suggestions.md b/docs/internal/marketing-source-suggestions.md
index 8ce77b9f0e0a..9d24c9a10858 100644
--- a/docs/internal/marketing-source-suggestions.md
+++ b/docs/internal/marketing-source-suggestions.md
@@ -187,13 +187,10 @@ The initial source check shows separate loading states for Ad performance and Se
Projects without sources show a connection card instead of empty metric placeholders.
Search performance stays visible while the paid-source event scan runs, fails, or returns no platforms.
Search performance remains behind `marketing-analytics-organic-keywords`.
-The paid-source onboarding and automatic dashboard scan are behind `marketing-analytics-source-onboarding`.
-Disabling this flag restores the original welcome, source connection, and conversion-goal wizard, including its source catalog and dashboard loading state.
-The source scan, enhanced catalog, dashboard section changes, and header feedback action require this flag.
Google Search Console onboarding stays behind its independent `marketing-analytics-organic-keywords` flag.
Mounting source setup state does not start the UTM audit; Integration health loads the audit when opened.
Search onboarding stays independent under `marketing-analytics-organic-keywords`.
-The read-only setup plan is available with `marketing-analytics-source-onboarding` or `marketing-analytics-setup`; other setup operations keep their existing flag requirements.
+The read-only setup plan is available to every project, because the paid-source onboarding scan reads it; applying setup operations requires `marketing-analytics-setup`.
Source setup uses a consistent panel for connection checks, event scanning, suggestions, empty results, and recoverable errors.
Detected platforms show concise evidence with expandable details.
@@ -242,8 +239,7 @@ Integration buttons show the external-link icon because their connection panels
The native integration catalog uses a consistent display order: Google Ads, Meta Ads, Bing Ads, LinkedIn Ads, TikTok Ads, Reddit Ads, Pinterest Ads, Snapchat Ads, OpenAI Ads, Apple Ads, Amazon Ads, Rokt Ads, and X Ads. Google Search Console stays in the search section.
-The separate Ad performance tab appears when `marketing-analytics-organic-keywords` is on and `marketing-analytics-source-onboarding` is off.
-Otherwise paid and organic reporting stay inside the Dashboard tab.
+Paid and organic reporting stay inside the Dashboard tab.
Detected-source suggestions keep the money hedgehog in the header, matching the empty state and manual catalog.
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 722541cd417b..4f70797c9e6e 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -13943,9 +13943,9 @@ snapshots:
scenes-app-marketing-analytics-search-performance--filtered-empty--light:
hash: v1.k794b7964.2bbf7fa8533562e5503224bbb0ee924988450600b31f67455f6d19ac9f960b41.cJwUit1hVGaYEfzuwpyqctvkjLXsJ5EfzXe_C7KCX0o
scenes-app-marketing-analytics-search-performance--flag-off--dark:
- hash: v1.k794b7964.0abe2d58ee70ac24582205caacee0e0b09831b9f04687d5ee1d9ec28f7f99be8.23pCSt9pA4N6R0id0jXh6Z0GpGSmmifTz1Ur090dRnY
+ hash: v1.k794b7964.d6785768e38447d90996c62716e0e28d3fdc673d000385d3db44aaeea6612ef3.TV52lqmtcHSUgUtvQHop79q0Gl80Bea2_3gvD1O5wOs
scenes-app-marketing-analytics-search-performance--flag-off--light:
- hash: v1.k794b7964.9336af8fdbf0c10e0dadbdc398517b3856ad19eae7ff0f580ddd507e4202b57b.92lmvS4XqmLPpRq2h7e7R_7p8x2ZpdvIaIAKZRL4lQU
+ hash: v1.k794b7964.c5fea6df16f992a8347a97b05845de075f7604dc7b666236398ce99a3ed1ee0b.6nATA0KOUjbp4VJqCuYQK6yVVtMilKYBwIZPdJpGXNI
scenes-app-marketing-analytics-search-performance--keyword-post-hog-conversions--dark:
hash: v1.k794b7964.5f54a7315b28b815d5c6ee7b84864ee643e2a279e3fdf4be2afd9cb4be040291.h17Z0vaKKEYZ3orFDAoYOW_d0wt9CpFBnTshgk02PPk
scenes-app-marketing-analytics-search-performance--keyword-post-hog-conversions--light:
@@ -13959,9 +13959,9 @@ snapshots:
scenes-app-marketing-analytics-search-performance--landing-pages--light:
hash: v1.k794b7964.dd554a599a0d095f78868c92fdfe331a84c6f6f138d4127cb0a5f8493730facc.vhQ-u2B_9Bejcm2aM7XDeekBubcBaRNMixO_gByXXFo
scenes-app-marketing-analytics-search-performance--legacy-scene--dark:
- hash: v1.k794b7964.02a8531fb005382f65d6ababe17b6902925cf1e85dc6e7a4f985bccd1b19e958.euygfkesoJLgv-DxHnmRl7KFhkH5i_CgoOAt5I7-yR8
+ hash: v1.k794b7964.2895cacebaed09478fa1e004576c9a72eff52a35aa85bb1a1e2d71aaea10f27b.xZtopsfICoSbbTEpvsKK84xgKGIIDVPbWXn9DiJi3x0
scenes-app-marketing-analytics-search-performance--legacy-scene--light:
- hash: v1.k794b7964.a11a911355e14774a6fb661339a173e564a2b23619aa79c8517006653e4a4c9a.OlaR7z6OsgLryr7PTWgCKzZEk1A-B2D00K2vSCF-LBI
+ hash: v1.k794b7964.a6b37e868d08ea343e39488b05df10a2b50324da7d3b438228be5797f4c21605._o9brsEwNkQRM4AWD35ESCQuKuCe53xmILSo0j1nHZA
scenes-app-marketing-analytics-search-performance--loading--dark:
hash: v1.k794b7964.7a36603ac510eb87c198b5f58af1e63790df5dba69b68ec4e029d31b8e039df8.5KMiknCw40jRDabVuNEY3-_UY6CcDHD8_4QomprfYZo
scenes-app-marketing-analytics-search-performance--loading--light:
@@ -14122,10 +14122,6 @@ snapshots:
hash: v1.k794b7964.62fc7b40cf0b423324e846f884bc21fad88dc54d250f896b3d69fa6f2e0e9b0a.RIDkDHCVSorSDCWgKoX_igSfSMDfCVx3gRKJG6o6xOE
scenes-app-marketing-analytics-source-onboarding--dashboard-with-search-console-only--light:
hash: v1.k794b7964.c9f51efaaee7c8e78ff34add75e51fbf0d35b94c7b2276e72dca91bf2b3ffa9c.bgC5Cf-kJPx9sA5p1y0zcKnPhFTdngI09MyGVEg8bSE
- scenes-app-marketing-analytics-source-onboarding--legacy-source-connection-step--dark:
- hash: v1.k794b7964.cbb45878988736b927d4ac4ee322346195265bda2c31b87ab82828e6a079004a.molamC87IHXFTcKHUOOS3JWbIfTDyuC7gXMl8m_rDAU
- scenes-app-marketing-analytics-source-onboarding--legacy-source-connection-step--light:
- hash: v1.k794b7964.446bc94527ca29bbd5cf95166c9f8e8c42116fb3c67a843b8d84841fdb20ee69.AN_uMyKLeS1A4SXrzlGIzfInn_5ckGTXB0vPQ07K5Yc
scenes-app-marketing-analytics-source-onboarding--manual-selection-with-search-console--dark:
hash: v1.k794b7964.c52074fded63e941836ca7900b31e08e6e3c13d3e5bf5da2cd475c39db18457d.3kObYq66NXOCoECXi3Yy8DnNrV29_kZ16EY3HjFnttQ
scenes-app-marketing-analytics-source-onboarding--manual-selection-with-search-console--light:
@@ -14134,14 +14130,6 @@ snapshots:
hash: v1.k794b7964.5b71002d90f449cbb3fd7c8eccb81ff9bdd75133e8574c5a8e91b4ba7557c68c.Ah9BOEl8MFTkgQW1HlejuA4rSkyWh4zB26W75DcV62U
scenes-app-marketing-analytics-source-onboarding--skip-during-scan--light:
hash: v1.k794b7964.75afc69fb6fa2eda4a15a9a9f69e51a4243846c95855d0455dc57ba53bb6a271.TmNXBByELHoDXLuO7JgP84EDijdkBMa_bvmX18PEqrc
- scenes-app-marketing-analytics-source-onboarding--source-onboarding-and-search-disabled--dark:
- hash: v1.k794b7964.1b8325913d0e5ca35b3c3bb71a7cf2e82733697d75ec33dc9e5c424e0c96309e.Ek1hjmU2pv5MKcxs-ZBpMYU5mspOvWxDnEB9YqZB9gg
- scenes-app-marketing-analytics-source-onboarding--source-onboarding-and-search-disabled--light:
- hash: v1.k794b7964.b270109ff72f4c7d7e35edc90902bfcd61a5af8eca44f3d93d4a7a3181dc977f.WQeRReiWRASqZuYHaIKCvfeKEAHGjmcegv4sBLhE1i4
- scenes-app-marketing-analytics-source-onboarding--source-onboarding-disabled-with-search--dark:
- hash: v1.k794b7964.2b326a8c412a3ba1db7defb337e970ef6630086b0f31389dd82b629266484a74.NDvyfvUS36mQ4OBnNKeegNAUTSggsgC-4FG08Qx01vk
- scenes-app-marketing-analytics-source-onboarding--source-onboarding-disabled-with-search--light:
- hash: v1.k794b7964.89316cba049955ebdf5881d03303fefacdee05670c234fe8b4f773e1af00cf62.RMRRBSE0NGmqpPVc_wOi1d0I9X2GOdgxKBRlO-xuctY
scenes-app-marketing-analytics-source-setup-panel--checking--dark:
hash: v1.k794b7964.6358b05db40c09854e171d16bfa8a28a3d52b255697b0b4df3bdcdb3e02e763a.N04cbrr5sudNaAkggpjroLP3WbPnUg9eSGAbB6sXVTw
scenes-app-marketing-analytics-source-setup-panel--checking--light:
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 1e891c1784ab..3dbc903b8e0a 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -417,8 +417,7 @@ export const FEATURE_FLAGS = {
MARKETING_ANALYTICS_RETURN_METRICS: 'marketing-analytics-return-metrics', // owner: @jabahamondes #team-web-analytics — gates the ROAS column
MARKETING_ANALYTICS_ROKT_ADS: 'marketing-analytics-rokt-ads', // owner: @jabahamondes #team-web-analytics
MARKETING_ANALYTICS_SEARCH_CONVERSIONS: 'marketing-analytics-search-conversions', // owner: @jabahamondes #team-web-analytics
- MARKETING_ANALYTICS_SETUP: 'marketing-analytics-setup', // owner: @jabahamondes #team-web-analytics — gates the Setup tab and its setup_plan / apply_setup_ops endpoints
- MARKETING_ANALYTICS_SOURCE_ONBOARDING: 'marketing-analytics-source-onboarding', // owner: @jabahamondes #team-web-analytics
+ MARKETING_ANALYTICS_SETUP: 'marketing-analytics-setup', // owner: @jabahamondes #team-web-analytics — gates the Setup tab and the apply_setup_ops endpoint
MARKETING_ANALYTICS_TWITTER_ADS: 'marketing-analytics-twitter-ads', // owner: @jabahamondes #team-web-analytics
MARKETING_ANALYTICS_UTM_AUDIT: 'marketing-analytics-utm-audit', // owner: @jabahamondes #team-web-analytics
MAX_AI_INSIGHT_SEARCH: 'max-ai-insight-search', // owner: #team-posthog-ai
diff --git a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx
index 3aaed93832b1..353698f6af05 100644
--- a/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx
+++ b/frontend/src/scenes/marketing-analytics/MarketingAnalyticsScene.tsx
@@ -3,7 +3,7 @@ import { BindLogic, useActions, useValues } from 'kea'
import { useEffect } from 'react'
import { IconComment, IconGear, IconSparkles } from '@posthog/icons'
-import { LemonBanner, LemonButton, LemonSwitch, LemonTabs, LemonSkeleton, Spinner, Link } from '@posthog/lemon-ui'
+import { LemonBanner, LemonButton, LemonSwitch, LemonTabs, Link } from '@posthog/lemon-ui'
import { Button } from '@posthog/quill'
import { supportLogic } from 'lib/components/Support/supportLogic'
@@ -30,6 +30,7 @@ import { ProductKey } from '~/queries/schema/schema-general'
import { sourcesDataLogic } from 'products/data_warehouse/frontend/shared/logics/sourcesDataLogic'
import { DetectedSources } from 'products/marketing_analytics/frontend/dashboard/DetectedSources'
import { SearchConsoleSource } from 'products/marketing_analytics/frontend/dashboard/SearchConsoleSource'
+import { SourceOnboarding } from 'products/marketing_analytics/frontend/dashboard/SourceOnboarding'
import { SourceSetupPanel } from 'products/marketing_analytics/frontend/dashboard/SourceSetupPanel'
import { marketingAnalyticsEmptyState } from 'products/marketing_analytics/frontend/emptyState/marketingAnalyticsEmptyState'
import { RecommendationsSection } from 'products/marketing_analytics/frontend/recommendations/RecommendationsSection'
@@ -40,7 +41,6 @@ import { useAttachedContext } from 'products/posthog_ai/frontend/api/logics'
import { LegacyOAuthReconnectBanner } from '../web-analytics/tabs/marketing-analytics/frontend/components/LegacyOAuthReconnectBanner'
import { MarketingAnalyticsFilters } from '../web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsFilters/MarketingAnalyticsFilters'
-import { MarketingAnalyticsSourceStatusBanner } from '../web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsSourceStatusBanner'
import { IntegrationSettingsModal } from '../web-analytics/tabs/marketing-analytics/frontend/components/settings/IntegrationSettingsModal'
import {
MarketingAnalyticsTab,
@@ -54,7 +54,6 @@ import {
} from '../web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsTilesLogic'
import { setupPlanLogic } from '../web-analytics/tabs/marketing-analytics/frontend/logic/setupPlanLogic'
import { marketingOnboardingLogic } from './Onboarding/marketingOnboardingLogic'
-import { Onboarding } from './Onboarding/Onboarding'
import { SetupTab } from './Setup/SetupTab'
export const scene: SceneExport = {
@@ -96,32 +95,7 @@ const QueryTileItem = ({ tile }: { tile: QueryTile }): JSX.Element => {
)
}
-const LegacySearchConnectionCard = (): JSX.Element | null => {
- const { isAdPerformance } = useValues(marketingAnalyticsLogic)
- const { showOnboarding } = useValues(marketingOnboardingLogic)
- if (showOnboarding && !isAdPerformance) {
- return null
- }
- return <SearchConsoleSource />
-}
-
-interface DashboardProps {
- statusAbove?: boolean
-}
-
-const MarketingAnalyticsDashboard = ({ statusAbove = false }: DashboardProps): JSX.Element => {
- const { featureFlags } = useValues(featureFlagLogic)
- return featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] ? (
- <SourceMarketingAnalyticsDashboard />
- ) : (
- <>
- <LegacyMarketingAnalyticsDashboard statusAbove={statusAbove} />
- <LegacySearchConnectionCard />
- </>
- )
-}
-
-const SourceMarketingAnalyticsDashboard = (): JSX.Element => {
+const MarketingAnalyticsDashboard = (): JSX.Element => {
const { featureFlags } = useValues(featureFlagLogic)
const {
hasSources,
@@ -173,17 +147,11 @@ const SourceMarketingAnalyticsDashboard = (): JSX.Element => {
return (
<>
<h2 className="mt-6 mb-0">Ad performance</h2>
- {featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] ? (
- <SourceSetupPanel
- state={sourcesLoadError ? 'error' : 'checking'}
- onRetry={loadSources}
- rescanLoading={loading}
- />
- ) : (
- <div className="flex justify-center p-8">
- <Spinner />
- </div>
- )}
+ <SourceSetupPanel
+ state={sourcesLoadError ? 'error' : 'checking'}
+ onRetry={loadSources}
+ rescanLoading={loading}
+ />
<SearchConsoleSource />
<DashboardConversionRecommendations />
</>
@@ -193,7 +161,7 @@ const SourceMarketingAnalyticsDashboard = (): JSX.Element => {
if (!isAdPerformance && !hasConfiguredSources && showOnboarding) {
return (
<>
- <Onboarding completeOnboarding={completeOnboarding} />
+ <SourceOnboarding completeOnboarding={completeOnboarding} />
<DashboardConversionRecommendations />
</>
)
@@ -211,9 +179,6 @@ const SourceMarketingAnalyticsDashboard = (): JSX.Element => {
/>
)}
<LegacyOAuthReconnectBanner />
- {!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && hasSyncedMarketingSources && (
- <MarketingAnalyticsSourceStatusBanner />
- )}
<h2 className="mt-6 mb-0">Ad performance</h2>
<DetectedSources compact={hasSearchConsole && !hasSyncedMarketingSources} dismissible />
<DashboardConversionRecommendations />
@@ -236,149 +201,6 @@ const SourceMarketingAnalyticsDashboard = (): JSX.Element => {
)
}
-// Loading placeholder that mirrors the real dashboard layout — an overview metric row, a chart card,
-// and a table card — instead of a single thin bar, so the page doesn't visibly reflow when data lands.
-const MarketingAnalyticsDashboardSkeleton = (): JSX.Element => (
- <div className="mt-4 flex flex-col gap-y-10">
- <div className="grid grid-cols-2 md:grid-cols-4 gap-4">
- {[0, 1, 2, 3].map((i) => (
- <div key={i} className="flex flex-col gap-2 p-4 border rounded">
- <LemonSkeleton className="h-3 w-20" />
- <LemonSkeleton className="h-8 w-24" />
- </div>
- ))}
- </div>
- <div className="flex flex-col gap-3">
- <LemonSkeleton className="h-6 w-40" />
- <div className="border rounded p-4">
- <LemonSkeleton className="h-64 w-full" />
- </div>
- </div>
- <div className="flex flex-col gap-3">
- <LemonSkeleton className="h-6 w-40" />
- <div className="border rounded p-4 flex flex-col gap-3">
- <LemonSkeleton className="h-8 w-full" />
- <LemonSkeleton.Row repeat={5} fade className="h-10" />
- </div>
- </div>
- </div>
-)
-
-const LegacyMarketingAnalyticsDashboard = ({ statusAbove }: DashboardProps): JSX.Element => {
- const { featureFlags } = useValues(featureFlagLogic)
- const {
- hasSources,
- hasNoConfiguredSources,
- loading,
- sourcesInitialLoading,
- isAdPerformance,
- includeConversionGoals,
- } = useValues(marketingAnalyticsLogic)
- const { setAdPerformanceConversionGoals } = useActions(marketingAnalyticsLogic)
- const { loadSources } = useActions(sourcesDataLogic)
- const { conversion_goals } = useValues(marketingAnalyticsSettingsLogic)
- const { tiles: marketingTiles } = useValues(marketingAnalyticsTilesLogic)
- const { showOnboarding, currentStep } = useValues(marketingOnboardingLogic)
- const { completeOnboarding, resetOnboarding } = useActions(marketingOnboardingLogic)
-
- // Reload sources on every navigation to this scene so newly configured
- // data warehouse sources are picked up without a full page refresh
- useEffect(() => {
- loadSources()
- }, [loadSources])
-
- // Auto-complete onboarding if user already has sources and conversion goals configured,
- // but only when not actively on the conversion-goals step (let the user click "Continue")
- useEffect(() => {
- if (
- !isAdPerformance &&
- !loading &&
- hasSources &&
- conversion_goals.length > 0 &&
- showOnboarding &&
- currentStep !== 'conversion-goals'
- ) {
- completeOnboarding()
- }
- }, [loading, hasSources, conversion_goals, showOnboarding, currentStep, completeOnboarding, isAdPerformance])
-
- // Reset onboarding if user truly has no configured sources (handles session/project changes).
- // Uses hasNoConfiguredSources which guards against premature evaluation while tables are loading.
- useEffect(() => {
- if (!isAdPerformance && hasNoConfiguredSources && !showOnboarding) {
- resetOnboarding()
- }
- }, [loading, hasSources, showOnboarding, resetOnboarding, isAdPerformance]) // oxlint-disable-line react-hooks/exhaustive-deps
-
- const feedbackBanner = (
- <LemonBanner
- type="info"
- action={{
- children: 'Send feedback',
- id: 'marketing-analytics-feedback-button',
- }}
- className="mt-4"
- >
- Marketing analytics is in beta. Please let us know what you'd like to see here and/or report any issues
- directly to us!
- </LemonBanner>
- )
-
- if (!isAdPerformance && !featureFlags[FEATURE_FLAGS.WEB_ANALYTICS_MARKETING]) {
- return (
- <>
- {feedbackBanner}
- <LemonBanner type="info">
- You can enable marketing analytics in the feature preview settings{' '}
- <Link to="https://app.posthog.com/settings/user-feature-previews#marketing-analytics">here</Link>.
- </LemonBanner>
- </>
- )
- }
-
- // Only the first load gets the skeleton: a background refresh (window focus, sync polling)
- // also sets `loading`, and swapping the tiles for the skeleton would remount and refetch them.
- if (sourcesInitialLoading) {
- return (
- <>
- {feedbackBanner}
- <MarketingAnalyticsDashboardSkeleton />
- </>
- )
- }
-
- if (!isAdPerformance && showOnboarding) {
- return (
- <>
- {feedbackBanner}
- <Onboarding completeOnboarding={completeOnboarding} />
- </>
- )
- }
-
- return (
- <>
- {feedbackBanner}
- {isAdPerformance && conversion_goals.length > 0 && (
- <LemonSwitch
- className="mt-4"
- label="Include conversion goals"
- checked={includeConversionGoals}
- onChange={setAdPerformanceConversionGoals}
- data-attr="marketing-ad-performance-conversion-goals"
- />
- )}
- <LegacyOAuthReconnectBanner />
- {!statusAbove && <MarketingAnalyticsSourceStatusBanner />}
- <div className="mt-4 grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-3 gap-x-4 gap-y-12">
- {marketingTiles?.map((tile, i) => (
- <QueryTileItem key={i} tile={tile} />
- ))}
- </div>
- </>
- )
-}
-
const MarketingAnalyticsContent = (): JSX.Element => {
const { featureFlags } = useValues(featureFlagLogic)
const { activeTab, hasSyncedMarketingSources, dataWarehouseSources, setupEnabled } =
@@ -393,14 +215,7 @@ const MarketingAnalyticsContent = (): JSX.Element => {
['GoogleAds', 'BingAds', 'GoogleSearchConsole'].includes(source.source_type)
)
- // With source onboarding on there is no ad performance tab, because the dashboard tab already is that page.
- const hasAdPerformanceTab =
- !featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] &&
- !!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_ORGANIC_KEYWORDS]
- const showRecommendations = !!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_RECOMMENDATIONS]
- // Connection problems affect every number on the page, so they go above the recommendations.
- const statusAbove = showRecommendations && !featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING]
- const recommendations = showRecommendations ? (
+ const recommendations = featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_RECOMMENDATIONS] ? (
<div className="mb-6">
<RecommendationsSection />
</div>
@@ -408,19 +223,10 @@ const MarketingAnalyticsContent = (): JSX.Element => {
const dashboard = (
<>
- {(!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] ||
- hasSyncedMarketingSources ||
- hasConnectedSearchSource) && (
- <MarketingAnalyticsFilters
- tabs={<></>}
- searchOnly={
- !!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] &&
- !hasSyncedMarketingSources &&
- hasConnectedSearchSource
- }
- />
+ {(hasSyncedMarketingSources || hasConnectedSearchSource) && (
+ <MarketingAnalyticsFilters tabs={<></>} searchOnly={!hasSyncedMarketingSources} />
)}
- {featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && recommendations}
+ {recommendations}
<MarketingAnalyticsDashboard />
{hasConnectedSearchSource && (
<div className="mt-8">
@@ -457,47 +263,6 @@ const MarketingAnalyticsContent = (): JSX.Element => {
const tabs = [
{ key: MarketingAnalyticsTab.DASHBOARD, label: 'Dashboard', content: dashboard },
- ...(hasAdPerformanceTab
- ? [
- {
- key: MarketingAnalyticsTab.AD_PERFORMANCE,
- label: 'Ad performance',
- content: (
- <>
- {(!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] ||
- hasSyncedMarketingSources ||
- hasConnectedSearchSource) && (
- <MarketingAnalyticsFilters
- tabs={<></>}
- searchOnly={
- !!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] &&
- !hasSyncedMarketingSources &&
- hasConnectedSearchSource
- }
- />
- )}
- {statusAbove && <MarketingAnalyticsSourceStatusBanner />}
- {recommendations}
- <MarketingAnalyticsDashboard statusAbove={statusAbove} />
- {hasConnectedSearchSource && (
- <div className="mt-8">
- <SearchPerformanceTab />
- </div>
- )}
- {integrationSettingsModal.integration && (
- <IntegrationSettingsModal
- integrationName={integrationSettingsModal.integration}
- isOpen={integrationSettingsModal.isOpen}
- onClose={closeIntegrationSettingsModal}
- initialTab={integrationSettingsModal.initialTab}
- initialUtmValue={integrationSettingsModal.initialUtmValue}
- />
- )}
- </>
- ),
- },
- ]
- : []),
...(featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_ATTRIBUTION]
? [
{
@@ -646,9 +411,7 @@ const MarketingAnalyticsAIToolWrapper = ({ children }: { children: React.ReactNo
export function MarketingAnalyticsScene(): JSX.Element {
const { openSupportForm } = useActions(supportLogic)
- const { featureFlags } = useValues(featureFlagLogic)
- const setupEnabled = !!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING]
- useEffect(() => (setupEnabled ? setupPlanLogic.mount() : undefined), [setupEnabled])
+ useEffect(() => setupPlanLogic.mount(), [])
const { activeTab } = useValues(marketingAnalyticsLogic)
const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')
@@ -667,15 +430,13 @@ export function MarketingAnalyticsScene(): JSX.Element {
actions={
todayRailNav ? (
<>
- {featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && (
- <Button
- variant="outline"
- onClick={() => openSupportForm({ kind: 'feedback', isEmailFormOpen: true })}
- >
- <IconComment />
- Send feedback
- </Button>
- )}
+ <Button
+ variant="outline"
+ onClick={() => openSupportForm({ kind: 'feedback', isEmailFormOpen: true })}
+ >
+ <IconComment />
+ Send feedback
+ </Button>
<Button
variant="outline"
render={
@@ -706,16 +467,14 @@ export function MarketingAnalyticsScene(): JSX.Element {
</>
) : (
<>
- {featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] && (
- <LemonButton
- type="secondary"
- size="small"
- icon={<IconComment />}
- onClick={() => openSupportForm({ kind: 'feedback', isEmailFormOpen: true })}
- >
- Send feedback
- </LemonButton>
- )}
+ <LemonButton
+ type="secondary"
+ size="small"
+ icon={<IconComment />}
+ onClick={() => openSupportForm({ kind: 'feedback', isEmailFormOpen: true })}
+ >
+ Send feedback
+ </LemonButton>
<LemonButton
to="https://posthog.com/docs/web-analytics/marketing-analytics"
type="secondary"
diff --git a/frontend/src/scenes/marketing-analytics/Onboarding/AddSourceStep.tsx b/frontend/src/scenes/marketing-analytics/Onboarding/AddSourceStep.tsx
deleted file mode 100644
index 231a7c5c6b1a..000000000000
--- a/frontend/src/scenes/marketing-analytics/Onboarding/AddSourceStep.tsx
+++ /dev/null
@@ -1,198 +0,0 @@
-import { useActions, useValues } from 'kea'
-import { router } from 'kea-router'
-
-import { IconArrowRight, IconCheckCircle, IconInfo } from '@posthog/icons'
-import { LemonButton, LemonCard, Link, Tooltip } from '@posthog/lemon-ui'
-
-import { FEATURE_FLAGS } from 'lib/constants'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-import { cn } from 'lib/utils/css-classes'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
-import { teamLogic } from 'scenes/teamLogic'
-import { urls } from 'scenes/urls'
-
-import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
-
-import { SourceIcon } from 'products/data_warehouse/frontend/shared/components/SourceIcon'
-
-import { marketingAnalyticsLogic } from '../../web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic'
-import {
- VALID_NON_NATIVE_MARKETING_SOURCES,
- VALID_SELF_MANAGED_MARKETING_SOURCES,
- getEnabledNativeMarketingSources,
-} from '../../web-analytics/tabs/marketing-analytics/frontend/logic/utils'
-
-interface MarketingSource {
- id: string
- isConnected: boolean
- category: 'native' | 'external' | 'self-managed'
-}
-
-interface AddSourceStepProps {
- onContinue: () => void
- hasSources: boolean
-}
-
-export function AddSourceStep({ onContinue, hasSources }: AddSourceStepProps): JSX.Element {
- const { validExternalTables, validNativeSources } = useValues(marketingAnalyticsLogic)
- const { featureFlags } = useValues(featureFlagLogic)
- const { reportMarketingAnalyticsDataSourceConnected } = useActions(eventUsageLogic)
- const { addProductIntent } = useActions(teamLogic)
-
- const enabledNativeSources = getEnabledNativeMarketingSources(featureFlags)
-
- const allSources: MarketingSource[] = [
- ...enabledNativeSources.map((sourceType) => ({
- id: sourceType,
- isConnected: validNativeSources.some((source) => source.source.source_type === sourceType),
- category: 'native' as const,
- })),
- ...VALID_NON_NATIVE_MARKETING_SOURCES.map((sourceType) => ({
- id: sourceType,
- isConnected: validExternalTables.some((table) => table.source_type === sourceType),
- category: 'external' as const,
- })),
- ...(featureFlags[FEATURE_FLAGS.DATA_WAREHOUSE_OBJECT_STORAGE_SOURCES]
- ? []
- : VALID_SELF_MANAGED_MARKETING_SOURCES
- ).map((sourceType) => ({
- id: sourceType,
- isConnected: validExternalTables.some((table) => table.source_type === sourceType),
- category: 'self-managed' as const,
- })),
- ]
-
- const handleSourceSelect = (sourceId: string): void => {
- reportMarketingAnalyticsDataSourceConnected(sourceId)
- addProductIntent({
- product_type: ProductKey.MARKETING_ANALYTICS,
- intent_context: ProductIntentContext.MARKETING_ANALYTICS_DATA_SOURCE_CONNECTED,
- metadata: { source_type: sourceId },
- })
- router.actions.push(
- urls.dataWarehouseSourceNew(
- sourceId,
- urls.marketingAnalyticsApp(),
- 'Marketing analytics',
- undefined,
- 'marketing_analytics_onboarding'
- )
- )
- }
-
- const nativeSources = allSources.filter((s) => s.category === 'native')
- const externalSources = allSources.filter((s) => s.category === 'external')
- const selfManagedSources = allSources.filter((s) => s.category === 'self-managed')
-
- const totalConnected = validNativeSources.length + validExternalTables.length
-
- return (
- <LemonCard hoverEffect={false}>
- <div className="space-y-3">
- {/* Header */}
- <div className="flex items-center justify-between">
- <div>
- <h3 className="text-base font-semibold mb-0.5">Connect your marketing sources</h3>
- <p className="text-xs text-muted-alt">
- {hasSources
- ? `${totalConnected} source${totalConnected !== 1 ? 's' : ''} connected — click to add more`
- : 'Select a platform to connect (opens data warehouse setup)'}
- </p>
- </div>
- </div>
-
- {/* Native Sources */}
- {nativeSources.length > 0 && (
- <div>
- <div className="text-xs font-medium text-muted mb-1.5">Native integrations (recommended)</div>
- <div className="flex flex-wrap gap-2">
- {nativeSources.map((source) => (
- <SourceChip key={source.id} source={source} onSelect={handleSourceSelect} />
- ))}
- </div>
- </div>
- )}
-
- {/* External Sources */}
- {externalSources.length > 0 && (
- <div>
- <div className="text-xs font-medium text-muted mb-1.5 flex items-center gap-1">
- Data warehouse
- <Tooltip
- title="Import marketing data you already have in a data warehouse like BigQuery."
- delayMs={0}
- >
- <IconInfo className="w-3 h-3 cursor-help" />
- </Tooltip>
- </div>
- <div className="flex flex-wrap gap-2">
- {externalSources.map((source) => (
- <SourceChip key={source.id} source={source} onSelect={handleSourceSelect} />
- ))}
- </div>
- </div>
- )}
-
- {/* Self-managed Sources */}
- {selfManagedSources.length > 0 && (
- <div>
- <div className="text-xs font-medium text-muted mb-1.5 flex items-center gap-1">
- Self-managed
- <Tooltip
- title="Connect your own data source (e.g. S3, GCS) where you already store marketing data."
- delayMs={0}
- >
- <IconInfo className="w-3 h-3 cursor-help" />
- </Tooltip>
- </div>
- <div className="flex flex-wrap gap-2">
- {selfManagedSources.map((source) => (
- <SourceChip key={source.id} source={source} onSelect={handleSourceSelect} />
- ))}
- </div>
- </div>
- )}
-
- {/* Footer */}
- <div className="flex items-center justify-between pt-3 border-t border-primary">
- <Link
- to="https://posthog.com/docs/web-analytics/marketing-analytics"
- target="_blank"
- className="text-xs"
- >
- View docs
- </Link>
- <LemonButton
- type="primary"
- size="small"
- onClick={onContinue}
- sideIcon={<IconArrowRight />}
- disabledReason={!hasSources ? 'Connect at least one source' : undefined}
- >
- Continue
- </LemonButton>
- </div>
- </div>
- </LemonCard>
- )
-}
-
-function SourceChip({ source, onSelect }: { source: MarketingSource; onSelect: (id: string) => void }): JSX.Element {
- return (
- <button
- type="button"
- className={cn(
- 'flex items-center gap-2 px-2.5 py-1.5 rounded-md border transition-all',
- source.isConnected
- ? 'border-success bg-success-lightest'
- : 'border-primary bg-bg-light hover:border-primary-dark hover:bg-fill-button-tertiary-hover',
- 'cursor-pointer'
- )}
- onClick={() => onSelect(source.id)}
- >
- <SourceIcon type={source.id} size="xsmall" disableTooltip />
- <span className="text-sm font-medium">{source.id}</span>
- {source.isConnected && <IconCheckCircle className="w-3.5 h-3.5 text-success" />}
- </button>
- )
-}
diff --git a/frontend/src/scenes/marketing-analytics/Onboarding/MarketingWizardStepper.tsx b/frontend/src/scenes/marketing-analytics/Onboarding/MarketingWizardStepper.tsx
deleted file mode 100644
index eae43f2afb83..000000000000
--- a/frontend/src/scenes/marketing-analytics/Onboarding/MarketingWizardStepper.tsx
+++ /dev/null
@@ -1,104 +0,0 @@
-import { IconCheckCircle } from '@posthog/icons'
-
-import { cn } from 'lib/utils/css-classes'
-
-import { MarketingOnboardingStep } from './marketingOnboardingLogic'
-
-interface Step {
- key: MarketingOnboardingStep
- label: string
- optional?: boolean
-}
-
-const STEPS: Step[] = [
- { key: 'welcome', label: 'Welcome' },
- { key: 'add-source', label: 'Add source' },
- { key: 'conversion-goals', label: 'Conversion goals', optional: true },
-]
-
-const STEP_ORDER: Record<MarketingOnboardingStep, number> = {
- welcome: 0,
- 'add-source': 1,
- 'conversion-goals': 2,
- done: 3,
-}
-
-interface MarketingWizardStepperProps {
- currentStep: MarketingOnboardingStep
- onStepClick: (step: MarketingOnboardingStep) => void
-}
-
-export function MarketingWizardStepper({ currentStep, onStepClick }: MarketingWizardStepperProps): JSX.Element {
- const currentOrder = STEP_ORDER[currentStep]
-
- return (
- <nav className="flex items-center justify-center mb-6" aria-label="Marketing analytics onboarding progress">
- {STEPS.map((step, index) => {
- const stepOrder = STEP_ORDER[step.key]
- const isCompleted = currentOrder > stepOrder
- const isCurrent = currentStep === step.key
-
- const button = (
- <button
- type="button"
- onClick={() => onStepClick(step.key)}
- className={cn(
- 'group flex items-center gap-1.5 px-2 py-1 rounded',
- 'transition-all duration-150',
- 'focus:outline-none focus-visible:ring-1 focus-visible:ring-accent',
- 'hover:bg-fill-button-tertiary-hover active:scale-[0.98]'
- )}
- aria-current={isCurrent ? 'step' : undefined}
- >
- {/* Indicator */}
- {isCompleted ? (
- <IconCheckCircle className="size-5 text-success" />
- ) : (
- <span
- className={cn(
- 'flex items-center justify-center size-5 rounded-full text-xs font-semibold',
- 'transition-all duration-150',
- isCurrent && 'bg-accent text-primary-inverse ring-2 ring-accent/25',
- !isCurrent && 'bg-surface-secondary text-secondary border border-primary'
- )}
- >
- {index + 1}
- </span>
- )}
-
- {/* Label */}
- <span
- className={cn(
- 'text-sm transition-colors duration-150',
- isCurrent && 'font-semibold text-primary',
- isCompleted && 'font-medium text-primary',
- !isCompleted && !isCurrent && 'text-secondary'
- )}
- >
- {step.label}
- </span>
-
- {step.optional && <span className="text-xs text-tertiary">(optional)</span>}
- </button>
- )
-
- return (
- <div key={step.key} className="flex items-center">
- {/* Connector */}
- {index > 0 && (
- <div
- className={cn(
- 'w-8 h-px transition-colors duration-150',
- isCompleted || isCurrent ? 'bg-success' : 'bg-border-primary'
- )}
- />
- )}
-
- {/* Step */}
- {button}
- </div>
- )
- })}
- </nav>
- )
-}
diff --git a/frontend/src/scenes/marketing-analytics/Onboarding/Onboarding.tsx b/frontend/src/scenes/marketing-analytics/Onboarding/Onboarding.tsx
deleted file mode 100644
index 1440917155db..000000000000
--- a/frontend/src/scenes/marketing-analytics/Onboarding/Onboarding.tsx
+++ /dev/null
@@ -1,172 +0,0 @@
-import { useActions, useValues } from 'kea'
-import { useEffect } from 'react'
-
-import * as moneyPng from '@posthog/brand/hoggies/png/money'
-import { IconArrowRight } from '@posthog/icons'
-import { LemonButton, LemonCard, Link } from '@posthog/lemon-ui'
-
-import { pngHoggie } from 'lib/brand/hoggies'
-import { ProductIntroduction } from 'lib/components/ProductIntroduction/ProductIntroduction'
-import { FEATURE_FLAGS } from 'lib/constants'
-import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
-import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
-import { teamLogic } from 'scenes/teamLogic'
-
-import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
-
-import { SearchConsoleSource } from 'products/marketing_analytics/frontend/dashboard/SearchConsoleSource'
-import { SourceOnboarding } from 'products/marketing_analytics/frontend/dashboard/SourceOnboarding'
-
-import { MarketingAnalyticsSourceStatusBanner } from '../../web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsSourceStatusBanner'
-import { ConversionGoalsConfiguration } from '../../web-analytics/tabs/marketing-analytics/frontend/components/settings/ConversionGoalsConfiguration'
-import { marketingAnalyticsLogic } from '../../web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic'
-import { marketingAnalyticsSettingsLogic } from '../../web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsSettingsLogic'
-import { AddSourceStep } from './AddSourceStep'
-import { MarketingOnboardingStep, marketingOnboardingLogic } from './marketingOnboardingLogic'
-import { MarketingWizardStepper } from './MarketingWizardStepper'
-
-const HedgehogMoney = pngHoggie(moneyPng)
-
-interface OnboardingProps {
- completeOnboarding: () => void
-}
-
-export function Onboarding({ completeOnboarding }: OnboardingProps): JSX.Element {
- const { featureFlags } = useValues(featureFlagLogic)
- return featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] ? (
- <SourceOnboarding completeOnboarding={completeOnboarding} />
- ) : (
- <>
- <LegacyOnboarding completeOnboarding={completeOnboarding} />
- <SearchConsoleSource />
- </>
- )
-}
-
-function LegacyOnboarding({ completeOnboarding }: OnboardingProps): JSX.Element {
- const { reportMarketingAnalyticsOnboardingViewed, reportMarketingAnalyticsOnboardingCompleted } =
- useActions(eventUsageLogic)
- const { addProductIntent } = useActions(teamLogic)
- const { hasSources } = useValues(marketingAnalyticsLogic)
- const { currentStep } = useValues(marketingOnboardingLogic)
- const { setStep, goToNextStep } = useActions(marketingOnboardingLogic)
-
- // If user has sources and is on welcome, skip to add-source
- useEffect(() => {
- if (hasSources && currentStep === 'welcome') {
- setStep('add-source')
- }
- }, [hasSources, currentStep, setStep])
-
- useOnMountEffect(() => {
- reportMarketingAnalyticsOnboardingViewed()
- })
-
- const handleComplete = (): void => {
- reportMarketingAnalyticsOnboardingCompleted(hasSources)
- addProductIntent({
- product_type: ProductKey.MARKETING_ANALYTICS,
- intent_context: ProductIntentContext.MARKETING_ANALYTICS_ONBOARDING_COMPLETED,
- metadata: { has_sources: hasSources },
- })
- completeOnboarding()
- }
-
- const handleStepClick = (step: MarketingOnboardingStep): void => {
- if (step === 'done') {
- handleComplete()
- } else {
- setStep(step)
- }
- }
-
- const handleNextStep = (): void => {
- if (currentStep === 'conversion-goals') {
- handleComplete()
- } else {
- goToNextStep()
- }
- }
-
- return (
- <div className="space-y-6">
- <MarketingWizardStepper currentStep={currentStep} onStepClick={handleStepClick} />
-
- {currentStep === 'welcome' && <WelcomeStep onContinue={() => setStep('add-source')} />}
-
- {currentStep === 'add-source' && (
- <>
- <MarketingAnalyticsSourceStatusBanner />
- <AddSourceStep onContinue={handleNextStep} hasSources={hasSources} />
- </>
- )}
-
- {currentStep === 'conversion-goals' && (
- <ConversionGoalsStep onContinue={handleComplete} onSkip={handleComplete} />
- )}
- </div>
- )
-}
-
-function WelcomeStep({ onContinue }: { onContinue: () => void }): JSX.Element {
- return (
- <ProductIntroduction
- thingName="marketing integration"
- titleOverride="Welcome to Marketing analytics"
- description="Track your marketing campaigns performance across all your ad platforms. Connect your data sources to see spend, conversions, and ROI in one place."
- action={onContinue}
- actionElementOverride={
- <LemonButton type="primary" onClick={onContinue} sideIcon={<IconArrowRight />}>
- Get started
- </LemonButton>
- }
- isEmpty={true}
- docsURL="https://posthog.com/docs/web-analytics/marketing-analytics"
- customHog={HedgehogMoney}
- />
- )
-}
-
-function ConversionGoalsStep({ onContinue, onSkip }: { onContinue: () => void; onSkip: () => void }): JSX.Element {
- const { conversion_goals } = useValues(marketingAnalyticsSettingsLogic)
- const hasConversionGoals = conversion_goals.length > 0
-
- return (
- <LemonCard hoverEffect={false}>
- <div className="space-y-4">
- <div>
- <h3 className="text-lg font-semibold mb-1">Configure conversion goals</h3>
- <p className="text-sm text-muted-alt">
- Define what actions count as conversions to measure your campaign effectiveness.
- </p>
- </div>
-
- <ConversionGoalsConfiguration hideTitle hideDescription />
-
- <div className="flex justify-end gap-2 pt-4 border-t border-primary">
- {!hasConversionGoals && (
- <LemonButton type="secondary" onClick={onSkip}>
- I'll configure later
- </LemonButton>
- )}
- <LemonButton
- type="primary"
- onClick={onContinue}
- sideIcon={<IconArrowRight />}
- disabledReason={!hasConversionGoals ? 'Add at least one conversion goal' : undefined}
- >
- Continue
- </LemonButton>
- </div>
-
- <div className="text-center">
- <p className="text-xs text-muted-alt">
- You can always configure conversion goals later in{' '}
- <Link to="/settings/environment-marketing-analytics">settings</Link>
- </p>
- </div>
- </div>
- </LemonCard>
- )
-}
diff --git a/frontend/src/scenes/marketing-analytics/Onboarding/constants.ts b/frontend/src/scenes/marketing-analytics/Onboarding/constants.ts
index 961645a7a90c..4398be7a9bb1 100644
--- a/frontend/src/scenes/marketing-analytics/Onboarding/constants.ts
+++ b/frontend/src/scenes/marketing-analytics/Onboarding/constants.ts
@@ -1,4 +1,3 @@
export const MARKETING_ONBOARDING_STORAGE_KEYS = {
COMPLETED: 'marketing-analytics-onboarding-completed',
- STEP: 'marketing-analytics-onboarding-step',
} as const
diff --git a/frontend/src/scenes/marketing-analytics/Onboarding/marketingOnboardingLogic.ts b/frontend/src/scenes/marketing-analytics/Onboarding/marketingOnboardingLogic.ts
index 33e65d2feecf..9c442d08bf89 100644
--- a/frontend/src/scenes/marketing-analytics/Onboarding/marketingOnboardingLogic.ts
+++ b/frontend/src/scenes/marketing-analytics/Onboarding/marketingOnboardingLogic.ts
@@ -1,15 +1,9 @@
-import { MakeLogicType, actions, kea, listeners, path, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, kea, listeners, path, reducers } from 'kea'
import { MARKETING_ONBOARDING_STORAGE_KEYS } from './constants'
-export type MarketingOnboardingStep = 'welcome' | 'add-source' | 'conversion-goals' | 'done'
-
-const STEP_ORDER: MarketingOnboardingStep[] = ['welcome', 'add-source', 'conversion-goals', 'done']
-
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface marketingOnboardingLogicValues {
- currentStep: MarketingOnboardingStep
- isLastStep: boolean
manualSourceSearch: string
showManualSources: boolean
showOnboarding: boolean
@@ -20,38 +14,17 @@ export interface marketingOnboardingLogicActions {
completeOnboarding: () => {
value: true
}
- goToNextStep: () => {
- value: true
- }
- resetOnboarding: () => {
- value: true
- }
setManualSourceSearch: (search: string) => {
search: string
}
setShowManualSources: (show: boolean) => {
show: boolean
}
- setShowOnboarding: (show: boolean) => {
- show: boolean
- }
- setStep: (step: MarketingOnboardingStep) => {
- step: MarketingOnboardingStep
- }
-}
-
-// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
-export interface marketingOnboardingLogicMeta {
- __keaTypeGenInternalSelectorTypes: {
- isLastStep: (currentStep: MarketingOnboardingStep) => boolean
- }
}
export type marketingOnboardingLogicType = MakeLogicType<
marketingOnboardingLogicValues,
- marketingOnboardingLogicActions,
- Record<string, any>,
- marketingOnboardingLogicMeta
+ marketingOnboardingLogicActions
>
export const marketingOnboardingLogic = kea<marketingOnboardingLogicType>([
@@ -60,69 +33,29 @@ export const marketingOnboardingLogic = kea<marketingOnboardingLogicType>([
actions({
setManualSourceSearch: (search: string) => ({ search }),
setShowManualSources: (show: boolean) => ({ show }),
- setStep: (step: MarketingOnboardingStep) => ({ step }),
- goToNextStep: true,
completeOnboarding: true,
- resetOnboarding: true,
- setShowOnboarding: (show: boolean) => ({ show }),
}),
reducers({
- manualSourceSearch: ['', { setManualSourceSearch: (_, { search }) => search, resetOnboarding: () => '' }],
+ manualSourceSearch: ['', { setManualSourceSearch: (_, { search }) => search }],
showManualSources: [
false,
{
setShowManualSources: (_, { show }) => show,
- resetOnboarding: () => false,
completeOnboarding: () => false,
},
],
- currentStep: [
- (localStorage.getItem(MARKETING_ONBOARDING_STORAGE_KEYS.STEP) as MarketingOnboardingStep) || 'welcome',
- {
- setStep: (_, { step }) => step,
- goToNextStep: (state) => {
- const currentIndex = STEP_ORDER.indexOf(state)
- const nextIndex = Math.min(currentIndex + 1, STEP_ORDER.length - 1)
- return STEP_ORDER[nextIndex]
- },
- resetOnboarding: () => 'welcome',
- },
- ],
showOnboarding: [
localStorage.getItem(MARKETING_ONBOARDING_STORAGE_KEYS.COMPLETED) !== 'true',
{
- setShowOnboarding: (_, { show }) => show,
completeOnboarding: () => false,
- resetOnboarding: () => true,
},
],
}),
- selectors({
- isLastStep: [
- (s) => [s.currentStep],
- (currentStep: MarketingOnboardingStep): boolean => currentStep === 'conversion-goals',
- ],
- }),
-
- listeners(({ actions, values }) => ({
- setStep: ({ step }) => {
- localStorage.setItem(MARKETING_ONBOARDING_STORAGE_KEYS.STEP, step)
- },
- goToNextStep: () => {
- localStorage.setItem(MARKETING_ONBOARDING_STORAGE_KEYS.STEP, values.currentStep)
- if (values.currentStep === 'done') {
- actions.completeOnboarding()
- }
- },
+ listeners(() => ({
completeOnboarding: () => {
localStorage.setItem(MARKETING_ONBOARDING_STORAGE_KEYS.COMPLETED, 'true')
- localStorage.removeItem(MARKETING_ONBOARDING_STORAGE_KEYS.STEP)
- },
- resetOnboarding: () => {
- localStorage.removeItem(MARKETING_ONBOARDING_STORAGE_KEYS.COMPLETED)
- localStorage.removeItem(MARKETING_ONBOARDING_STORAGE_KEYS.STEP)
},
})),
])
diff --git a/frontend/src/scenes/marketing-analytics/Setup/SetupTab.tsx b/frontend/src/scenes/marketing-analytics/Setup/SetupTab.tsx
index 89730d5f0131..ea67811d9167 100644
--- a/frontend/src/scenes/marketing-analytics/Setup/SetupTab.tsx
+++ b/frontend/src/scenes/marketing-analytics/Setup/SetupTab.tsx
@@ -149,11 +149,9 @@ export function SetupTab(): JSX.Element {
)}
{/* Skipped for "Suggested setup", which renders the whole ranked list
itself and would otherwise show everything twice. */}
- {active.key !== SetupSection.SUGGESTIONS &&
- !(
- active.key === SetupSection.SOURCES &&
- featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING]
- ) && <SectionSuggestions section={active.key} />}
+ {active.key !== SetupSection.SUGGESTIONS && active.key !== SetupSection.SOURCES && (
+ <SectionSuggestions section={active.key} />
+ )}
{featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_CONVERSION_SETUP_AI] &&
(active.key === SetupSection.SUGGESTIONS || active.key === SetupSection.CONVERSION_GOALS) && (
<ConversionGoalRecommendations
diff --git a/products/marketing_analytics/backend/api.py b/products/marketing_analytics/backend/api.py
index 08a038ce840e..8e862194cf2d 100644
--- a/products/marketing_analytics/backend/api.py
+++ b/products/marketing_analytics/backend/api.py
@@ -120,8 +120,8 @@ def _marketing_feature_enabled(request: Request, team: Team, flag: str) -> bool:
)
-def _setup_enabled(request: Request, team: Team, *, include_read_only: bool = False) -> bool:
- """Evaluate eligible marketing flags once per request.
+def _setup_enabled(request: Request, team: Team) -> bool:
+ """Evaluate the setup flag once per request.
Evaluated for the requesting person, because the flag's release conditions target
people and the frontend renders the Setup tab off that same per-person answer.
@@ -130,34 +130,23 @@ def _setup_enabled(request: Request, team: Team, *, include_read_only: bool = Fa
condition matches too. Cached on the request because a second call in the same one
would fire a redundant `$feature_flag_called`.
"""
- cache_attribute = "_ma_read_only_setup_flag" if include_read_only else "_ma_setup_flag"
- cached = getattr(request, cache_attribute, None)
+ cached = getattr(request, "_ma_setup_flag", None)
if cached is not None:
return cached
person_properties = {}
email = getattr(request.user, "email", None)
if email:
person_properties["email"] = email
- enabled = any(
- feature_enabled_or_false(
- flag,
- # Service credentials authenticate as a synthetic user with no person behind them;
- # the team UUID keeps the call well-formed, and a person condition won't match it.
- getattr(request.user, "distinct_id", None) or str(team.uuid),
- groups={"organization": str(team.organization.id)},
- person_properties=person_properties,
- group_properties={"organization": {"id": str(team.organization.id)}},
- )
- for flag in (
- "marketing-analytics-setup",
- *(
- ("marketing-analytics-source-onboarding", "marketing-analytics-setup-plan-mcp")
- if include_read_only
- else ()
- ),
- )
+ enabled = feature_enabled_or_false(
+ "marketing-analytics-setup",
+ # Service credentials authenticate as a synthetic user with no person behind them;
+ # the team UUID keeps the call well-formed, and a person condition won't match it.
+ getattr(request.user, "distinct_id", None) or str(team.uuid),
+ groups={"organization": str(team.organization.id)},
+ person_properties=person_properties,
+ group_properties={"organization": {"id": str(team.organization.id)}},
)
- setattr(request, cache_attribute, enabled)
+ request._ma_setup_flag = enabled # type: ignore[attr-defined]
return enabled
@@ -1792,7 +1781,6 @@ class MarketingAnalyticsViewSet(TeamAndOrgViewSetMixin, GenericViewSet):
response=SetupPlanResponseSerializer,
description="Ranked, machine-applicable setup suggestions plus per-capability readiness",
),
- 404: OpenApiResponse(description="Marketing Setup and new dashboard feature flags are both off"),
},
summary="Get the marketing analytics setup plan",
description=(
@@ -1806,10 +1794,6 @@ class MarketingAnalyticsViewSet(TeamAndOrgViewSetMixin, GenericViewSet):
)
@action(methods=["GET"], detail=False, url_path="setup_plan", required_scopes=["marketing_analytics:read"])
def setup_plan(self, request: Request, *args, **kwargs) -> Response:
- # 404 rather than 403: an unreleased endpoint should look absent, not forbidden.
- if not _setup_enabled(request, self.team, include_read_only=True):
- raise NotFound("Marketing analytics setup is not enabled for this project.")
-
date_from = request.validated_query_data["date_from"]
# `IsAuthenticated` on the viewset rules out AnonymousUser, which is the only
# reason `.pk` is optional here.
@@ -1850,7 +1834,7 @@ class MarketingAnalyticsViewSet(TeamAndOrgViewSetMixin, GenericViewSet):
description="The applied operations and the ops that reverse them",
),
400: OpenApiResponse(description="An operation was malformed, unsupported, or not applicable"),
- 404: OpenApiResponse(description="Marketing Setup and new dashboard feature flags are both off"),
+ 404: OpenApiResponse(description="Marketing analytics setup is not enabled for this project"),
},
summary="Apply setup operations",
description=(
@@ -1862,8 +1846,7 @@ class MarketingAnalyticsViewSet(TeamAndOrgViewSetMixin, GenericViewSet):
)
@action(methods=["POST"], detail=False, url_path="apply_setup_ops", required_scopes=["marketing_analytics:write"])
def apply_setup_ops(self, request: Request, *args, **kwargs) -> Response:
- # Same gate as setup_plan: the ops only come from a plan, so an unreleased
- # read side means there is nothing legitimate to apply.
+ # 404 rather than 403: an unreleased endpoint should look absent, not forbidden.
if not _setup_enabled(request, self.team):
raise NotFound("Marketing analytics setup is not enabled for this project.")
diff --git a/products/marketing_analytics/backend/test_api_apply_setup_ops.py b/products/marketing_analytics/backend/test_api_apply_setup_ops.py
index d837a0b0cc04..ebab298442ed 100644
--- a/products/marketing_analytics/backend/test_api_apply_setup_ops.py
+++ b/products/marketing_analytics/backend/test_api_apply_setup_ops.py
@@ -9,6 +9,7 @@ from posthog.constants import AvailableFeature
from posthog.models.organization import OrganizationMembership
from posthog.models.team.extensions import get_or_create_team_extension
from posthog.models.team.team_marketing_analytics_config import TeamMarketingAnalyticsConfig
+from posthog.models.user import User
from products.access_control.backend.models.access_control import AccessControl
@@ -419,26 +420,47 @@ class TestApplySetupOpsFeatureFlag(APIBaseTest):
get_or_create_team_extension(self.team, TeamMarketingAnalyticsConfig)
cache.clear()
- @parameterized.expand([(False, False), (False, True), (True, False), (True, True)])
- def test_setup_availability(self, setup: bool, mcp: bool) -> None:
+ def apply(self):
+ return self.client.post(
+ self.url,
+ {"ops": [{"op": "add_custom_source_mapping", "integration": "MetaAds", "raw_utm_source": "fb-ads"}]},
+ format="json",
+ )
+
+ @parameterized.expand([(False,), (True,)])
+ def test_setup_availability(self, setup: bool) -> None:
self.organization_membership.level = OrganizationMembership.Level.ADMIN
self.organization_membership.save()
- flags = {
- "marketing-analytics-setup": setup,
- "marketing-analytics-setup-plan-mcp": mcp,
- }
- with patch(_FLAG_TARGET, side_effect=lambda flag, *args, **kwargs: flags[flag]):
- response = self.client.post(
- self.url,
- {"ops": [{"op": "add_custom_source_mapping", "integration": "MetaAds", "raw_utm_source": "fb-ads"}]},
- format="json",
- )
+ with patch(_FLAG_TARGET, return_value=setup):
+ response = self.apply()
assert response.status_code == (200 if setup else 404)
assert TeamMarketingAnalyticsConfig.objects.get(team=self.team).custom_source_mappings == (
{"MetaAds": ["fb-ads"]} if setup else {}
)
+ def test_the_flag_is_evaluated_once_per_request(self):
+ # A second call in the same request would fire a redundant `$feature_flag_called`.
+ with patch(_FLAG_TARGET, return_value=False) as flag:
+ self.apply()
+
+ assert flag.call_count == 1
+
+ def test_the_flag_is_evaluated_for_the_requesting_person(self):
+ # The flag targets people, and the frontend renders the Setup tab off that same
+ # per-person answer. Evaluating it against the team instead answers for nobody, so
+ # the tab lands on an endpoint that 404s. Two people to also catch an answer
+ # cached somewhere that outlives one request.
+ other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
+
+ with patch(_FLAG_TARGET, return_value=False) as flag:
+ self.apply()
+ self.client.force_login(other_user)
+ self.apply()
+
+ assert [call.args[1] for call in flag.call_args_list] == [self.user.distinct_id, other_user.distinct_id]
+ assert flag.call_args.kwargs["groups"] == {"organization": str(self.team.organization.id)}
+
class TestApplySetupOpsRequiresProjectAdmin(APIBaseTest):
"""`marketing_analytics:write` resolves to `editor` (the resource's default level),
diff --git a/products/marketing_analytics/backend/test_api_setup_plan.py b/products/marketing_analytics/backend/test_api_setup_plan.py
index 5218e59074eb..20c44b1c0658 100644
--- a/products/marketing_analytics/backend/test_api_setup_plan.py
+++ b/products/marketing_analytics/backend/test_api_setup_plan.py
@@ -7,8 +7,6 @@ from unittest.mock import patch
from django.core.cache import cache
from django.utils import timezone
-from parameterized import parameterized
-
from posthog.models.organization import Organization, OrganizationMembership
from posthog.models.team.team import Team
from posthog.models.user import User
@@ -162,67 +160,16 @@ class TestSetupPlanEndpoint(APIBaseTest):
assert response.status_code in (403, 404)
-class TestSetupPlanFeatureFlag(APIBaseTest):
- def setUp(self):
- super().setUp()
- self.url = f"/api/projects/{self.team.pk}/marketing_analytics/setup_plan"
- cache.clear()
-
- @parameterized.expand(
- [
- (False, False, False),
- (False, False, True),
- (False, True, False),
- (True, False, False),
- (True, True, True),
- ]
- )
- def test_setup_availability(self, setup: bool, onboarding: bool, mcp: bool) -> None:
- flags = {
- "marketing-analytics-setup": setup,
- "marketing-analytics-source-onboarding": onboarding,
- "marketing-analytics-setup-plan-mcp": mcp,
- }
+class TestSetupPlanAvailability(APIBaseTest):
+ def test_the_plan_needs_no_feature_flag(self) -> None:
with (
- patch(_FLAG_TARGET, side_effect=lambda flag, *args, **kwargs: flags[flag]),
+ patch(_FLAG_TARGET, return_value=False),
patch(_PLAN_TARGET, return_value=_plan()) as build,
):
- response = self.client.get(self.url)
-
- assert response.status_code == (200 if setup or onboarding or mcp else 404)
- assert build.call_count == int(setup or onboarding or mcp)
+ response = self.client.get(f"/api/projects/{self.team.pk}/marketing_analytics/setup_plan")
- def test_marketing_access_does_not_enable_source_onboarding(self) -> None:
- with (
- patch(_FLAG_TARGET, side_effect=lambda flag, *args, **kwargs: flag == "marketing-analytics"),
- patch(_PLAN_TARGET) as build,
- ):
- response = self.client.get(self.url)
-
- assert response.status_code == 404
- build.assert_not_called()
-
- def test_the_flag_is_evaluated_once_per_request(self):
- # A second call in the same request would fire a redundant `$feature_flag_called`.
- with patch(_FLAG_TARGET, return_value=True) as flag, patch(_PLAN_TARGET, return_value=_plan()):
- self.client.get(self.url)
-
- assert flag.call_count == 1
-
- def test_the_flag_is_evaluated_for_the_requesting_person(self):
- # The flag targets people, and the frontend renders the Setup tab off that same
- # per-person answer. Evaluating it against the team instead answers for nobody, so
- # the tab lands on an endpoint that 404s. Two people to also catch an answer
- # cached somewhere that outlives one request.
- other_user = User.objects.create_and_join(self.organization, "[email protected]", None)
-
- with patch(_FLAG_TARGET, return_value=True) as flag, patch(_PLAN_TARGET, return_value=_plan()):
- self.client.get(self.url)
- self.client.force_login(other_user)
- self.client.get(self.url)
-
- assert [call.args[1] for call in flag.call_args_list] == [self.user.distinct_id, other_user.distinct_id]
- assert flag.call_args.kwargs["groups"] == {"organization": str(self.team.organization.id)}
+ assert response.status_code == 200
+ build.assert_called_once()
def _clean_plan() -> SetupPlan:
diff --git a/products/marketing_analytics/frontend/dashboard/DetectedSources.tsx b/products/marketing_analytics/frontend/dashboard/DetectedSources.tsx
index 5becff2d217b..bc0ef943acdc 100644
--- a/products/marketing_analytics/frontend/dashboard/DetectedSources.tsx
+++ b/products/marketing_analytics/frontend/dashboard/DetectedSources.tsx
@@ -2,8 +2,6 @@ import { useActions, useValues } from 'kea'
import { LemonButton } from '@posthog/lemon-ui'
-import { FEATURE_FLAGS } from 'lib/constants'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { marketingOnboardingLogic } from 'scenes/marketing-analytics/Onboarding/marketingOnboardingLogic'
import { teamLogic } from 'scenes/teamLogic'
import { MarketingAnalyticsSourceStatusBanner } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/components/MarketingAnalyticsSourceStatusBanner'
@@ -38,7 +36,6 @@ export function DetectedSources({
} = useValues(setupPlanLogic)
const { rescanSources, restoreAllDismissed } = useActions(setupPlanLogic)
const { currentTeamId } = useValues(teamLogic)
- const { featureFlags } = useValues(featureFlagLogic)
const { showIntegrations } = useValues(detectedSourcesLogic({ teamId: currentTeamId ?? 0 }))
const { dismissSource, setShowIntegrations } = useActions(detectedSourcesLogic({ teamId: currentTeamId ?? 0 }))
const { allAvailableSourcesWithStatus, nativeSources, hasSyncedMarketingSources } =
@@ -68,9 +65,6 @@ export function DetectedSources({
setManualSourceSearch('')
setShowIntegrations(true)
}
- if (!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING]) {
- return null
- }
if (showIntegrations) {
return (
<>
diff --git a/products/marketing_analytics/frontend/dashboard/SourceOnboarding.stories.tsx b/products/marketing_analytics/frontend/dashboard/SourceOnboarding.stories.tsx
index 59f0181e70a9..f36fc32c2f44 100644
--- a/products/marketing_analytics/frontend/dashboard/SourceOnboarding.stories.tsx
+++ b/products/marketing_analytics/frontend/dashboard/SourceOnboarding.stories.tsx
@@ -6,7 +6,6 @@ import { useEffect } from 'react'
import { FEATURE_FLAGS } from 'lib/constants'
import { MarketingAnalyticsScene } from 'scenes/marketing-analytics/MarketingAnalyticsScene'
import { marketingOnboardingLogic } from 'scenes/marketing-analytics/Onboarding/marketingOnboardingLogic'
-import { Onboarding } from 'scenes/marketing-analytics/Onboarding/Onboarding'
import { urls } from 'scenes/urls'
import { marketingAnalyticsLogic } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/marketingAnalyticsLogic'
@@ -18,6 +17,7 @@ import { expect, userEvent } from 'storybook/test'
import type { SuggestionApi } from '../generated/api.schemas'
import { SearchConsoleSource } from './SearchConsoleSource'
import { SourceCatalog } from './SourceCatalog'
+import { SourceOnboarding } from './SourceOnboarding'
import { SourceOnboardingScan } from './SourceOnboardingScan'
const suggestion = (kind: string, integration: string, label: string): SuggestionApi => ({
@@ -53,7 +53,7 @@ const meta: Meta = {
component: SourceOnboardingScan,
parameters: {
layout: 'padded',
- featureFlags: [FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING, FEATURE_FLAGS.MARKETING_ANALYTICS_SETUP],
+ featureFlags: [FEATURE_FLAGS.MARKETING_ANALYTICS_SETUP],
},
decorators: [
mswDecorator({
@@ -83,7 +83,7 @@ export function SkipDuringScan(): JSX.Element {
useStorybookMocks({
get: { '/api/projects/:team_id/marketing_analytics/setup_plan/': () => new Promise(() => {}) },
})
- return <Onboarding completeOnboarding={() => {}} />
+ return <SourceOnboarding completeOnboarding={() => {}} />
}
SkipDuringScan.parameters = { testOptions: { waitForLoadersToDisappear: false } }
SkipDuringScan.play = async ({ canvasElement }: { canvasElement: HTMLElement }): Promise<void> => {
@@ -316,11 +316,7 @@ export function AdPerformanceWithoutSources(): JSX.Element {
}
AdPerformanceWithoutSources.parameters = {
pageUrl: urls.marketingAnalyticsApp(),
- featureFlags: [
- FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING,
- FEATURE_FLAGS.WEB_ANALYTICS_MARKETING,
- FEATURE_FLAGS.MARKETING_ANALYTICS_SETUP,
- ],
+ featureFlags: [FEATURE_FLAGS.WEB_ANALYTICS_MARKETING, FEATURE_FLAGS.MARKETING_ANALYTICS_SETUP],
}
AdPerformanceWithoutSources.play = async ({ canvasElement }: { canvasElement: HTMLElement }): Promise<void> => {
const canvas = within(canvasElement)
@@ -373,11 +369,7 @@ export function ManualSelectionWithSearchConsole(): JSX.Element {
)
}
ManualSelectionWithSearchConsole.parameters = {
- featureFlags: [
- FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING,
- FEATURE_FLAGS.MARKETING_ANALYTICS_ORGANIC_KEYWORDS,
- FEATURE_FLAGS.MARKETING_ANALYTICS_SETUP,
- ],
+ featureFlags: [FEATURE_FLAGS.MARKETING_ANALYTICS_ORGANIC_KEYWORDS, FEATURE_FLAGS.MARKETING_ANALYTICS_SETUP],
}
ManualSelectionWithSearchConsole.play = async ({ canvasElement }: { canvasElement: HTMLElement }): Promise<void> => {
const canvas = within(canvasElement)
@@ -400,7 +392,6 @@ export const DashboardWithSearchConsoleOnly = dashboardStory(plan.suggestions, f
DashboardWithSearchConsoleOnly.parameters = {
pageUrl: urls.marketingAnalyticsApp(),
featureFlags: [
- FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING,
FEATURE_FLAGS.WEB_ANALYTICS_MARKETING,
FEATURE_FLAGS.MARKETING_ANALYTICS_SETUP,
FEATURE_FLAGS.MARKETING_ANALYTICS_ORGANIC_KEYWORDS,
@@ -492,63 +483,3 @@ DashboardNoDetectionsWithSearch.play = async ({ canvasElement }: { canvasElement
await expect(canvas.findByText('Choose an ad platform')).resolves.toBeVisible()
await expect(canvas.findByText('Connect your search sources')).resolves.toBeVisible()
}
-
-export function SourceOnboardingDisabledWithSearch(): JSX.Element {
- return <InitialOnboardingDisabledWithSearch />
-}
-SourceOnboardingDisabledWithSearch.parameters = {
- ...AdPerformanceWithoutSources.parameters,
- featureFlags: [FEATURE_FLAGS.WEB_ANALYTICS_MARKETING, FEATURE_FLAGS.MARKETING_ANALYTICS_ORGANIC_KEYWORDS],
-}
-SourceOnboardingDisabledWithSearch.play = async ({ canvasElement }: { canvasElement: HTMLElement }): Promise<void> => {
- const canvas = within(canvasElement)
- await expect(canvas.findByText('Welcome to Marketing analytics')).resolves.toBeVisible()
- expect(canvas.getByRole('navigation', { name: 'Marketing analytics onboarding progress' })).toBeVisible()
- await expect(canvas.findByText('Connect your search sources')).resolves.toBeVisible()
- expect(canvas.queryByPlaceholderText('Search integrations')).not.toBeInTheDocument()
- expect(canvas.queryByText('Choose an ad platform')).not.toBeInTheDocument()
- expect(canvas.queryByText('Scan again')).not.toBeInTheDocument()
- expect(canvas.queryByText('Could not check your events')).not.toBeInTheDocument()
-}
-
-export function SourceOnboardingAndSearchDisabled(): JSX.Element {
- return <InitialOnboardingDisabledWithSearch />
-}
-SourceOnboardingAndSearchDisabled.parameters = {
- ...AdPerformanceWithoutSources.parameters,
- featureFlags: [FEATURE_FLAGS.WEB_ANALYTICS_MARKETING],
-}
-SourceOnboardingAndSearchDisabled.play = async ({ canvasElement }: { canvasElement: HTMLElement }): Promise<void> => {
- const canvas = within(canvasElement)
- await expect(canvas.findByText('Welcome to Marketing analytics')).resolves.toBeVisible()
- expect(canvas.getByRole('navigation', { name: 'Marketing analytics onboarding progress' })).toBeVisible()
- expect(canvas.queryByPlaceholderText('Search integrations')).not.toBeInTheDocument()
- expect(canvas.queryByRole('heading', { name: 'Search performance' })).not.toBeInTheDocument()
- expect(canvas.queryByText('Scan again')).not.toBeInTheDocument()
-}
-
-function InitialOnboardingDisabledWithSearch(): JSX.Element {
- useDashboardWithoutSourcesMocks()
- const { resetOnboarding } = useActions(marketingOnboardingLogic)
- useEffect(() => resetOnboarding(), [resetOnboarding])
- return <MarketingAnalyticsScene />
-}
-
-export function LegacySourceConnectionStep(): JSX.Element {
- useDashboardWithoutSourcesMocks()
- const { resetOnboarding, setStep } = useActions(marketingOnboardingLogic)
- useEffect(() => {
- resetOnboarding()
- setStep('add-source')
- }, [resetOnboarding, setStep])
- return <MarketingAnalyticsScene />
-}
-LegacySourceConnectionStep.parameters = SourceOnboardingAndSearchDisabled.parameters
-LegacySourceConnectionStep.play = async ({ canvasElement }: { canvasElement: HTMLElement }): Promise<void> => {
- const canvas = within(canvasElement)
- await expect(canvas.findByText('Connect your marketing sources')).resolves.toBeVisible()
- expect(canvas.getByRole('navigation', { name: 'Marketing analytics onboarding progress' })).toBeVisible()
- expect(canvas.queryByPlaceholderText('Search integrations')).not.toBeInTheDocument()
- await userEvent.click(canvas.getByRole('button', { name: /Conversion goals/ }))
- await expect(canvas.findByText('Configure conversion goals')).resolves.toBeVisible()
-}
diff --git a/products/marketing_analytics/frontend/dashboard/SourceOnboarding.tsx b/products/marketing_analytics/frontend/dashboard/SourceOnboarding.tsx
index 9bec3463b814..32fe8baf3dbb 100644
--- a/products/marketing_analytics/frontend/dashboard/SourceOnboarding.tsx
+++ b/products/marketing_analytics/frontend/dashboard/SourceOnboarding.tsx
@@ -1,8 +1,6 @@
import { useActions, useValues } from 'kea'
-import { FEATURE_FLAGS } from 'lib/constants'
import { useOnMountEffect } from 'lib/hooks/useOnMountEffect'
-import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { eventUsageLogic } from 'lib/utils/eventUsageLogic'
import { marketingOnboardingLogic } from 'scenes/marketing-analytics/Onboarding/marketingOnboardingLogic'
import { teamLogic } from 'scenes/teamLogic'
@@ -30,8 +28,6 @@ export function SourceOnboarding({ completeOnboarding }: { completeOnboarding: (
const { showManualSources } = useValues(marketingOnboardingLogic)
const { setShowManualSources } = useActions(marketingOnboardingLogic)
const { hasSources } = useValues(marketingAnalyticsLogic)
- const { featureFlags } = useValues(featureFlagLogic)
- const sourceOnboardingEnabled = !!featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING]
useOnMountEffect(() => {
reportMarketingAnalyticsOnboardingViewed()
@@ -50,11 +46,11 @@ export function SourceOnboarding({ completeOnboarding }: { completeOnboarding: (
return (
<div className="space-y-4">
<MarketingAnalyticsSourceStatusBanner />
- {!sourceOnboardingEnabled || showManualSources ? (
+ {showManualSources ? (
<SourceCatalog
onContinue={handleComplete}
hasSources={hasSources}
- onBack={sourceOnboardingEnabled ? () => setShowManualSources(false) : undefined}
+ onBack={() => setShowManualSources(false)}
/>
) : (
<SourceOnboardingScan
diff --git a/products/marketing_analytics/frontend/dashboard/detectedSourcesLogic.test.ts b/products/marketing_analytics/frontend/dashboard/detectedSourcesLogic.test.ts
index b254d279bd3f..ff06c72bb69b 100644
--- a/products/marketing_analytics/frontend/dashboard/detectedSourcesLogic.test.ts
+++ b/products/marketing_analytics/frontend/dashboard/detectedSourcesLogic.test.ts
@@ -2,7 +2,6 @@ import { MOCK_TEAM_ID } from 'lib/api.mock'
import { expectLogic } from 'kea-test-utils'
-import { FEATURE_FLAGS } from 'lib/constants'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { setupPlanLogic } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/setupPlanLogic'
@@ -30,18 +29,11 @@ describe('detectedSourcesLogic', () => {
setupPlanLogic.mount()
})
- it('starts the scan when the onboarding flag arrives after mount', async () => {
+ it('starts the scan once on mount', async () => {
const logic = detectedSourcesLogic({ teamId: MOCK_TEAM_ID })
- logic.mount()
- expect(setupPlanLogic.values.setupPlanLoading).toBe(false)
await expectLogic(setupPlanLogic, () => {
- featureFlagLogic.actions.setFeatureFlags([], {
- [FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING]: true,
- })
- featureFlagLogic.actions.setFeatureFlags([], {
- [FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING]: true,
- })
+ logic.mount()
}).toDispatchActions(['loadSetupPlan', 'loadSetupPlanSuccess'])
expect(setupPlanRequests).toBe(1)
logic.unmount()
diff --git a/products/marketing_analytics/frontend/dashboard/detectedSourcesLogic.ts b/products/marketing_analytics/frontend/dashboard/detectedSourcesLogic.ts
index a9b20358ec2c..a000a78a57f6 100644
--- a/products/marketing_analytics/frontend/dashboard/detectedSourcesLogic.ts
+++ b/products/marketing_analytics/frontend/dashboard/detectedSourcesLogic.ts
@@ -11,13 +11,8 @@ import { sourcesDataLogic } from 'products/data_warehouse/frontend/shared/logics
type DetectedSourcesProps = { teamId: number }
-function loadSetupPlanIfEnabled(teamId: number): void {
- if (
- featureFlagLogic.values.featureFlags[FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING] &&
- teamId &&
- !setupPlanLogic.values.setupPlan &&
- !setupPlanLogic.values.setupPlanLoading
- ) {
+function loadSetupPlanIfNeeded(teamId: number): void {
+ if (teamId && !setupPlanLogic.values.setupPlan && !setupPlanLogic.values.setupPlanLoading) {
setupPlanLogic.actions.loadSetupPlan()
}
}
@@ -67,11 +62,9 @@ export const detectedSourcesLogic = kea<
}
logic.actions.clearLegacyDismissals()
},
- // The app can render on the flag timeout, so the onboarding flag may arrive after mount.
- [featureFlagLogic.actionTypes.setFeatureFlags]: () => loadSetupPlanIfEnabled(props.teamId),
})),
afterMount(({ props, cache }) => {
- loadSetupPlanIfEnabled(props.teamId)
+ loadSetupPlanIfNeeded(props.teamId)
cache.disposables.add(() => {
const refreshSources = (): void => {
if (!marketingAnalyticsLogic.values.loading) {
diff --git a/products/marketing_analytics/frontend/setup/SetupConversionFlag.test.tsx b/products/marketing_analytics/frontend/setup/SetupConversionFlag.test.tsx
index 977204cbc2fe..4775271dc10b 100644
--- a/products/marketing_analytics/frontend/setup/SetupConversionFlag.test.tsx
+++ b/products/marketing_analytics/frontend/setup/SetupConversionFlag.test.tsx
@@ -77,7 +77,6 @@ describe('conversion setup feature flag', () => {
featureFlagLogic.actions.setFeatureFlags([], {
[FEATURE_FLAGS.MARKETING_ANALYTICS_SETUP]: setup,
[FEATURE_FLAGS.MARKETING_ANALYTICS_CONVERSION_SETUP_AI]: ai,
- [FEATURE_FLAGS.MARKETING_ANALYTICS_SOURCE_ONBOARDING]: true,
})
sourcesDataLogic.mount()
sourcesDataLogic.actions.loadSourcesSuccess({ count: 0, next: null, previous: null, results: [] })