See the money: Capturing revenue with PostHog

Last updated:

|Edit this page
Plan with your teammates
Get this intro to PostHog as a private repo you can share with your team. Learn the basics while documenting the specifics of your integration.

While the analytics tasks so far have been full of subtlety, revenue is easy.

It's binary.

Either someone has given us money or they have not.

There are two options for tracking revenue in PostHog.

Option 1 – Manual revenue capture

Gathering data about revenue can be straightforward: you know exactly when you get paid, and hopefully you can work backwards from that to the precursor events you should also measure.

Start with the place in the product where money changes hands. Put an event there. In addition, capture metadata using event properties: how much money the customer paid and what they paid for.

If you're selling subscriptions, record the subscription timeframe. If you're selling products, include the products they purchased. For example:

JavaScript
posthog.capture('subscription_purchased', {
months: 12,
price: 19.99
})

Try to keep property values strictly numeric – months: 12 instead of term: 12_months – to preserve flexibility in building reports later on.

Even if you don't have a lot of variation in what you're selling at first, record the details now so that later expansions, experiments, or sales compare easily with historical data.

Now, let's think about the critical path before payment happens. What are the stages or actions that are impossible to bypass to make a purchase?

These should have events tracked as well. Again, adding metadata to the event properties can help build better reporting and answer questions in the future.

If we've got an upsell or call to action that lists a specific price, that's great to include as an event property

Option 2 – Automating revenue capture with data warehouse

Even at the earliest stages of a business, data can be scattered between multiple services, forcing you to constantly open multiple browser tabs just to keep up, which means your events might not give you all the data you need.

Instead of setting up complex event-sending pipelines, you can bring the data directly into PostHog's data warehouse and analyze it all from there.

PostHog's data warehouse solves this problem by aggregating multiple data sources. Your dashboards can then report everything captured from data warehouse and analytics events in a single view. You can even build insights that traverse both.

You can query anything from your app database with data warehouse. Data warehouse also provides quick setup for ongoing capture of revenue events from Stripe and Chargebee.

Just don't forget to capture the events leading to revenue.

Planning revenue reporting

How will you report revenue?

  • Data warehouse?
  • Manual events?

Which events are revenue-generating? Are they already tracked, or do you need to add additional tracking to capture them?

Revenue reporting

With revenue logged, we can build reports to understand how much revenue is captured over time. This is a great way to understand the health of a business.

A trends insight is a great start for your revenue reporting:

  • Create a new trends insight
  • Edit the series to choose your revenue-bearing event
  • In the aggregation menu to the right of the selected event, choose property value > sum
  • In the rightmost menu, choose the property that captures the revenue from your event

It will look like something like this:

revenue series configuration

From here we can choose the timespan for the report, grouping anywhere from hourly to monthly, with comparisons to the previous period if helpful.

Your product in one dashboard

a complete dashboard

With revenue and all your key events captured, you can build a dashboard like this that covers:

  • Growth of daily, weekly, or monthly active users
  • Conversion from sign up to activation
  • Retention of users after they activate
  • Revenue trends relative to your goals

In other words, everything that's important to your business.

Next steps

Growing your product and revenue is an infinite game, and PostHog gives you all the tools you need to play. Some things you can try:

Don't forget to brush up on PostHog basics while you're here.

Questions? Ask Max AI.

It's easier than reading through 604 docs articles.

Community questions

Was this page useful?

Next article

Understanding PostHog

PostHog is a lot of power, so to get the most from it, we should review how data is structured, grouped, and related. Events PostHog's data model starts with events , single actions that a user triggered at a specific point in time. These are sent either from one of our SDKs or directly via our API . Events are flexible: they can be captured automatically via autocapture , or you can capture your own custom events and attach additional metadata via properties . You might create an event…

Read next article