posthog icon indicating copy to clipboard operation
posthog copied to clipboard

feat(marketing-analytics): add conversion goals configuration

Open jabahamondes opened this issue 7 months ago â€ĸ 7 comments

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?

How did you test this code?

Manually image

image image

jabahamondes avatar Jun 11 '25 15:06 jabahamondes

📸 UI snapshots have been updated

18 snapshot changes in total. 0 added, 18 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Jun 11 '25 15:06 posthog-bot

📸 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 storybook locally and make the fix now. (Often, the cause is ResizeObserver being 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Jun 11 '25 15:06 posthog-bot

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%)

compressed-size-action

github-actions[bot] avatar Jun 11 '25 15:06 github-actions[bot]

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Jun 11 '25 19:06 posthog-bot

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Jun 11 '25 21:06 posthog-bot

📸 UI snapshots have been updated

17 snapshot changes in total. 0 added, 17 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Jun 15 '25 17:06 posthog-bot

📸 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 storybook locally and make the fix now. (Often, the cause is ResizeObserver being 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Jun 15 '25 17:06 posthog-bot

Will fix conflicts after approval đŸĢĄ

jabahamondes avatar Jun 17 '25 14:06 jabahamondes

@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?

jabahamondes avatar Jun 18 '25 09:06 jabahamondes

📸 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.

👉 Review this PR's diff of snapshots.

posthog-bot avatar Jun 18 '25 10:06 posthog-bot

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;

github-actions[bot] avatar Jun 18 '25 10:06 github-actions[bot]