feat(marketing-analytics): add conversion goals configuration
Problem
Need for the definition of conversion goals so we can calculate and map it to the marketing costs.
Changes
New conversion goal field added to marketing settings in the team model. Added the conversion goal ui setting to be able to create new conversion goals. Updated the "massive" query (sorry this will be refactored in a query runner once we are ok with all) so it can have dynamic conversion goal to be added to the table.
Each conversion goal is mapped by default to utm_source and utm_campaign properties unless it's a datawarehouse table. In that case we enforce to select which column we want to map.
I also add the utm_source and utm_campaign mapping in the configurations. That's because we can have different utm_campaign (ids) for the same campaign. We then would like to see the data per campaign.
Did you write or update any docs for this change?
- [ ] I've added or updated the docs
- [ ] I've reached out for help from the docs team
- [x] No docs needed for this change
How did you test this code?
Manually
đ¸ UI snapshots have been updated
18 snapshot changes in total. 0 added, 18 modified, 0 deleted:
-
chromium: 0 added, 18 modified, 0 deleted (diff for shard 1, diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
[!CAUTION]
Detected flapping snapshots
These snapshots have auto-updated more than once since the last human commit:
scenes-app-data-management--revenue-analytics-settings--dark.png(chromium, shard 2)scenes-app-data-management--revenue-analytics-settings--light.png(chromium, shard 2)The flippy-flappies are deadly and must be fixed ASAP. They're productivity killers. Run
pnpm storybooklocally and make the fix now. (Often, the cause isResizeObserverbeing used instead of the better CSS container queries.)
-
chromium: 0 added, 2 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
Size Change: +829 B (+0.03%)
Total Size: 2.57 MB
âšī¸ View Unchanged
| Filename | Size | Change |
|---|---|---|
frontend/dist/toolbar.js |
2.57 MB | +829 B (+0.03%) |
đ¸ UI snapshots have been updated
16 snapshot changes in total. 0 added, 16 modified, 0 deleted:
-
chromium: 0 added, 16 modified, 0 deleted (diff for shard 1) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
16 snapshot changes in total. 0 added, 16 modified, 0 deleted:
-
chromium: 0 added, 16 modified, 0 deleted (diff for shard 1) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
17 snapshot changes in total. 0 added, 17 modified, 0 deleted:
-
chromium: 0 added, 17 modified, 0 deleted (diff for shard 1, diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
[!CAUTION]
Detected flapping snapshots
These snapshots have auto-updated more than once since the last human commit:
scenes-app-insights-funnels--funnel-top-to-bottom-breakdown--light.png(chromium, shard 2)The flippy-flappies are deadly and must be fixed ASAP. They're productivity killers. Run
pnpm storybooklocally and make the fix now. (Often, the cause isResizeObserverbeing used instead of the better CSS container queries.)
-
chromium: 0 added, 1 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
Will fix conflicts after approval đĢĄ
@lricoy yes, we should be able to just filter the conversion goal in the dashboard as well at some point! Btw how do you image the conversion goals? do you have something in mind so I can think of?
đ¸ UI snapshots have been updated
1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
-
chromium: 0 added, 1 modified, 0 deleted (diff for shard 2) -
webkit: 0 added, 0 modified, 0 deleted
Triggered by this commit.
Migration SQL Changes
Hey đ, we've detected some migrations on this PR. Here's the SQL output for each migration, make sure they make sense:
posthog/migrations/0773_teammarketinganalyticsconfig__conversion_goals.py
BEGIN;
--
-- Add field _conversion_goals to teammarketinganalyticsconfig
--
ALTER TABLE "posthog_teammarketinganalyticsconfig" ADD COLUMN "conversion_goals" jsonb DEFAULT '[]'::jsonb NULL;
ALTER TABLE "posthog_teammarketinganalyticsconfig" ALTER COLUMN "conversion_goals" DROP DEFAULT;
COMMIT;