Revenue tracking

Last updated:

|Edit this page

Important: This feature is currently in beta. Please leave a comment on this page if you have feedback or questions, or leave feedback via the in-app support modal.

Our revenue tracking feature enables you to capture revenue from your website via the events you are already sending us, or an integration with a payment platform, which you can then track in your web analytics dashboard.

web analytics dashboard

Choosing a revenue data source

PostHog can collect revenue from two sources:

Option 1: Properties on events

The simplest way to send us revenue data is to add it as properties on revenue generating events, such as when a purchase is completed, a user starts a subscription, or a subscription is renewed.

When you do so, you need to include two properties:

  • value: The amount of revenue generated by the event.
  • currency: The currency of the revenue in ISO 4217 format (USD, EUR, GBP, etc.).

You can choose any name you like for these properties – you can customize them in the Revenue tab in data management.

revenue tab

The currency property is technically optional as you can choose a static currency when configuring your revenue event in your dashboard, but we recommend sending it if you can to ensure backward compatibility should you ever take payments in a different currency.

Option 2: Data warehouse tables

You can also expose your revenue data from your Data Warehouse tables.

The configuration for these is similar to the events configuration, but you'll need to choose three columns:

  • value: The amount of revenue generated by the event.
  • currency: The currency of the revenue in ISO 4217 format (USD, EUR, GBP, etc.).
  • timestamp: The timestamp of when the revenue was generated.

For data Warehouse tables, you're required to choose a currency from one of its columns.

We currently have a built-in connection to Stripe, which will allow you to import your Stripe payment data directly into PostHog. Integrations with other payment platforms, such as RevenueCat and LemonSqueezy, are coming soon.

First, need to connect your Stripe account to PostHog. You can follow our Stripe integration docs to do so.

Once you've connected your Stripe account, go to the Revenue tab in Data management and choose the stripe_charge table and the amount, currency and created_at columns from the Stripe data.

revenue data source configuration

And that's all, you'll immediately see your revenue data in your Web Analytics dashboard.

revenue data source

Using revenue data in product analytics

You can use your revenue data for deeper product analytics insights beyond the web analytics dashboard, too. This allows you to:

  • Create custom revenue funnels
  • Analyze user journeys that lead to purchases
  • Segment users by revenue contribution

When working with revenue data in product analytics, you may want to use the convertCurrency function for accurate reporting across different currencies.

Sending backend events for revenue tracking

You can send revenue tracking events from your backend systems, which is especially useful for tracking purchases that complete outside of the browser.

When sending backend events, you must include a session_id to ensure they appear in web analytics. The session ID connects the backend purchase event with the user's web session.

The session_id should be a UUID V7 that uniquely identifies the user's session.

You can generate a random one, but ideally you should reuse the same value we generated in our Frontend SDK, so that all events belong to the same session in our UI.

You can learn more about how to do this in the session docs.

Example backend event:

JavaScript
posthog.capture({
distinct_id: posthog_distinct_id,
event: 'Purchase Succeeded',
properties: {
'$session_id': posthog_session_id,
value: 100,
currency: 'USD',
}
})

Troubleshooting & FAQ

Can I change the default reporting currency in PostHog?

Yes. You can select your desired currency in the Revenue tab in Data management. This is the currency we'll use to report revenue in our web analytics dashboard.

base currency configuration

How do you convert renvenue in different currencies?

We automatically convert revenue from other currencies into your chosen reporting currency – i.e. if someone makes a purchase in Canadian Dollars (CAD) and your reporting currency is US Dollars (USD), it's converted into USD in PostHog to ensure consistency.

PostHog's currency conversion data is sourced from Open Exchange Rates. The exchange rate data is updated hourly and stored with daily granularity.

This ensures that your revenue data is converted using recent exchange rates, based on the exchange rate at the time of the event, providing reliable revenue analytics across different currencies.

Which currencies do you support?

PostHog supports a wide range of global currencies for revenue tracking. See our currencies.py file for a complete list.

What if you don't support the currency on my revenue event?

This is unlikely given the large range of currencies we support, but in this event we'd track that revenue event as if it had 0 value. We welcome feature requests for currencies you'd like us to support.

Why isn't my revenue appearing in the web analytics overview?

If your revenue isn't appearing in your web analytics dashboard, there are a few common issues to check:

  1. Check the Revenue tab in Data management: First, verify if your revenue events are being captured correctly by checking the Revenue tab in data management.

  2. Missing session ID: Revenue events must include a session ID to appear in web analytics. Without this identifier, PostHog cannot associate the revenue with a particular web session.

Can I query converted rates?

Yes, you can query converted rates yourself in SQL using the convertCurrency function. This is useful for custom queries and advanced analytics.

Example:

SQL
SELECT
*,
properties.$currency as original_currency,
properties.value as original_value,
convertCurrency(original_currency, 'USD', original_value, timestamp) as value_usd
FROM events
WHERE event = 'purchase'

The signature for the convertCurrency function is:

convertCurrency(
from_currency: string,
to_currency: string,
value: Decimal,
timestamp: Date | DateTime
) -> Decimal

Can I correlate revenue with paid ads data?

This feature is current under development. Soon, PostHog will support sources for importing ad expense data, allowing you to analyze return on ad spend directly within the platform.

Can I compute cost CAC and CPC?

Computing Customer Acquisition Cost (CAC) and Cost Per Click (CPC) will be possible once we've completed integrations with ad expense platforms. These metrics will provide valuable insights into your marketing efficiency and return on investment.

Can I use custom currency conversion data?

Currently, PostHog does not support using custom currency conversion data. We rely on the exchange rates provided by Open Exchange Rates.

If you need support for custom conversion rates, please create a feature request, so our team can consider adding this functionality.

Questions? Ask Max AI.

It's easier than reading through 613 docs articles.

Community questions

Was this page useful?

Next article

FAQs

Have a question not covered here? Let us know . What is the difference between web analytics and product analytics? Web analytics is a streamlined experience for tracking and monitoring your most important website metrics. Product analytics is a more powerful and flexible experience for tracking your product. For a more detailed description of the difference, check out our page on web vs product analytics . How much does web analytics cost? Web analytics is no additional cost on top of product…

Read next article