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(marketing-analytics): track intent for all advertising sources (#106336)

Javier Bahamondes74299d1d61f3
diff --git a/docs/published/handbook/engineering/data-warehouse.md b/docs/published/handbook/engineering/data-warehouse.md
index fedb0e533c1d..98bbe58fdf2e 100644
--- a/docs/published/handbook/engineering/data-warehouse.md
+++ b/docs/published/handbook/engineering/data-warehouse.md
@@ -12,6 +12,12 @@ Looking to add a new source to data warehouse? [We have a detailed guide in the
> If you're a customer of PostHog Cloud and are looking to import data into your project, then you're likely looking for [this section of the docs instead](https://posthog.com/docs/cdp/sources)
+Selecting a source in the `Advertising` category records Marketing analytics product intent as well as Data warehouse intent.
+This happens when the user selects the connector, before credentials are validated or data syncs.
+The category covers new advertising connectors automatically; it does not mean Marketing analytics supports their data natively.
+Selecting a source outside this category, such as BigQuery, records only Data warehouse intent.
+Supported self-managed providers keep their separate Marketing analytics intent tracking.
+
## Importing your local Postgres instance
1. Head to the [new source flow](http://localhost:8010/project/pipeline/new/source) in your local app, hit the link button next to Postgres
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
index 8f60eae4f782..56719f687c05 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/sourceWizardLogic.tsx
@@ -16,12 +16,9 @@ import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
import { Scene } from 'scenes/sceneTypes'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
-import {
- VALID_NON_NATIVE_MARKETING_SOURCES,
- VALID_SELF_MANAGED_MARKETING_SOURCES,
-} from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/utils'
+import { VALID_SELF_MANAGED_MARKETING_SOURCES } from 'scenes/web-analytics/tabs/marketing-analytics/frontend/logic/utils'
-import { ProductIntentContext, ProductKey, VALID_NATIVE_MARKETING_SOURCES } from '~/queries/schema/schema-general'
+import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import {
Breadcrumb,
ExternalDataSourceCreatePayload,
@@ -2513,18 +2510,7 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([
})
// Track interest for marketing ad sources and marketing analytics
- const isNativeMarketingSource =
- connector?.name &&
- VALID_NATIVE_MARKETING_SOURCES.includes(
- connector.name as (typeof VALID_NATIVE_MARKETING_SOURCES)[number]
- )
- const isExternalMarketingSource =
- connector?.name &&
- VALID_NON_NATIVE_MARKETING_SOURCES.includes(
- connector.name as (typeof VALID_NON_NATIVE_MARKETING_SOURCES)[number]
- )
-
- if (isNativeMarketingSource || isExternalMarketingSource) {
+ if (connector?.category === 'Advertising') {
actions.addProductIntent({
product_type: ProductKey.MARKETING_ANALYTICS,
intent_context: ProductIntentContext.MARKETING_ANALYTICS_ADS_INTEGRATION_VISITED,
diff --git a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts
index 28460378ecb3..1a198b294311 100644
--- a/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts
+++ b/products/data_warehouse/frontend/scenes/NewSourceScene/tests/sourceWizardLogic.test.ts
@@ -1,7 +1,10 @@
+import { MOCK_DEFAULT_TEAM } from 'lib/api.mock'
+
import { expectLogic } from 'kea-test-utils'
import api from 'lib/api'
+import { ProductIntentContext, ProductKey } from '~/queries/schema/schema-general'
import { initKeaTests } from '~/test/init'
import type { ExternalDataSourceSyncSchema, IncrementalField } from '~/types'
@@ -38,6 +41,56 @@ describe('sourceWizardLogic', () => {
initKeaTests()
})
+ it.each<{
+ name: SourceConfigResponseApi['name']
+ category: SourceConfigResponseApi['category']
+ marketingIntent: boolean
+ }>([
+ { name: 'AdRoll', category: 'Advertising', marketingIntent: true },
+ { name: 'AppLovin', category: 'Advertising', marketingIntent: true },
+ { name: 'Outbrain', category: 'Advertising', marketingIntent: true },
+ { name: 'Taboola', category: 'Advertising', marketingIntent: true },
+ { name: 'AmazonAds', category: 'Advertising', marketingIntent: true },
+ { name: 'AppleSearchAds', category: 'Advertising', marketingIntent: true },
+ { name: 'OpenAIAds', category: 'Advertising', marketingIntent: true },
+ { name: 'RoktAds', category: 'Advertising', marketingIntent: true },
+ { name: 'MetaAds', category: 'Advertising', marketingIntent: true },
+ { name: 'MetaAds', category: null, marketingIntent: false },
+ { name: 'BigQuery', category: 'Databases', marketingIntent: false },
+ { name: 'Postgres', category: 'Databases', marketingIntent: false },
+ { name: 'Hubspot', category: 'CRM', marketingIntent: false },
+ { name: 'Mailchimp', category: 'Marketing & email', marketingIntent: false },
+ ])('records expected intents for $name ($category)', async ({ name, category, marketingIntent }) => {
+ const source = buildSourceConfig({ name, category })
+ const updateIntent = jest.spyOn(api.productIntents, 'update').mockResolvedValue(MOCK_DEFAULT_TEAM)
+ const logic = sourceWizardLogic({ availableSources: { [name]: source } })
+ const unmount = logic.mount()
+
+ try {
+ await expectLogic(logic, () => {
+ logic.actions.selectConnector(source)
+ }).toFinishAllListeners()
+
+ expect(updateIntent.mock.calls.map(([intent]) => intent)).toEqual([
+ {
+ product_type: ProductKey.DATA_WAREHOUSE,
+ intent_context: ProductIntentContext.SELECTED_CONNECTOR,
+ },
+ ...(marketingIntent
+ ? [
+ {
+ product_type: ProductKey.MARKETING_ANALYTICS,
+ intent_context: ProductIntentContext.MARKETING_ANALYTICS_ADS_INTEGRATION_VISITED,
+ },
+ ]
+ : []),
+ ])
+ } finally {
+ unmount()
+ updateIntent.mockRestore()
+ }
+ })
+
it('shares a single wizard instance across references with the same props', () => {
const postgresSource = buildSourceConfig({ name: 'Postgres' })
const availableSources = { Postgres: postgresSource }