posthog icon indicating copy to clipboard operation
posthog copied to clipboard

feat: Max UI revenue context

Open kappa90 opened this issue 7 months ago • 4 comments

[!IMPORTANT] 👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Problem

🔴 Requires this PR to be merged first

We started working on exposing revenue analytics data to Max, for example in this PR, which tries to expose data warehouse tables connected to revenue, to Max.

This PR builds on a new approach, where we inject context into Max directly from the frontend, in this case, revenue analytics context. This will allow Max to respond to revenue-based questions, when viewing the Revenue Analytics page.

Max can now read custom RevenueAnalyticsOverviewQuery, RevenueAnalyticsGrowthRateQuery and RevenueAnalyticsTopCustomersQuery.

Next steps will be to give Max the ability to trigger these queries regardless of which page the user is looking at.

Changes

  • Add Revenue Analytics queries to the new maxContextLogic
  • Support Revenue Analytics queries in the query executor/formatter

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
  • [ ] No docs needed for this change

How did you test this code?

Draft PR

kappa90 avatar May 28 '25 05:05 kappa90

And adding to this what I've already shared in Slack:


There are some information you could get from the DWH/Rev Analytics tables/views that you cant get from these custom insights yet.

I would prefer Max to use those tables too in case the customer asks something more specific (revenue by cohort for example), but just insights is a lot better than nothing.

The best case for me is: Max should know those views exist. It should also know which events are revenue-related (Max is trying to guess right now rather than use the customer-provided info) to create custom insights on its own. It should usually just point to the Rev Analytics dashboards, but be able to use SQL if something more specific is needed

rafaeelaudibert avatar May 28 '25 18:05 rafaeelaudibert

And adding to this what I've already shared in Slack:

There are some information you could get from the DWH/Rev Analytics tables/views that you cant get from these custom insights yet.

I would prefer Max to use those tables too in case the customer asks something more specific (revenue by cohort for example), but just insights is a lot better than nothing.

The best case for me is: Max should know those views exist. It should also know which events are revenue-related (Max is trying to guess right now rather than use the customer-provided info) to create custom insights on its own. It should usually just point to the Rev Analytics dashboards, but be able to use SQL if something more specific is needed

Where do we store information about which events are revenue-related?

kappa90 avatar May 28 '25 18:05 kappa90

@kappa90

Where do we store information about which events are revenue-related?

team.revenue_analytics_config.events contains that information

rafaeelaudibert avatar May 28 '25 18:05 rafaeelaudibert

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

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

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week. If you want to permanentely keep it open, use the waiting label.

posthog-bot avatar Jun 23 '25 07:06 posthog-bot

This PR was closed due to lack of activity. Feel free to reopen if it's still relevant.

posthog-bot avatar Jul 01 '25 07:07 posthog-bot