Payment events and revenue tracking


In this article we’ll review some best practices for tracking revenue.

Revenue is a special property in our tracking API. We recognize the revenue key and translate it into the format each integration expects. That way you don’t have to learn the details about every single tool you try out.

For example, when you track an event property labeled revenue to Segment with KISSmetrics, Mixpanel, and Adwords enabled. We’ll translate the revenue property into a format each tool will recognize: Billing amount for KISSmetrics, track_chargefor Mixpanel, and value for Adwords.

Client Side

Tracking revenue client side from either a browser or a mobile app is the simplest way to get up and running. Client-side revenue tracking is great for transactions that occur immediately when your customer is still present on your site or app.

Below are some situations where revenue is tracked from the client:

Advertising Conversions

The most common use case for client-side revenue tracking is to trigger ad conversion pixels. If you need to attribute revenue back to an ad network for conversion reports and ROI calculations you’ll need to track revenue in client-side javascript.


Customers are almost always present when an e-commerce charge is made. They visit a store, browse products, fill up their cart, and pay - all from their browser. This makes e-commerce a perfect candidate for client-side revenue tracking.

Once the purchase is finalized, the revenue can be tracked from the thank you page through a Completed Order event. See a full example in our e-commerce docs.

Recurring Revenue

SaaS, membership sites, subscriptions, etc. rely on recurring revenue so they are usually not great candidates for client-side revenue tracking. That’s because the customer is rarely present on your site when they are charged.

The only time client-side revenue tracking makes sense for this model is during the initial purchase. When a user first signs up and pays for their first month of service, or perhaps they purchase a lifetime or annual license.

If you track the initial revenue from the client, chances are you’ll track recurring charges for that subscription from your servers.

Make sure you do not track the initial purchase revenue to your analytics tools twice (once from the client and again from your servers).

For recurring revenue your revenue events will be pretty basic. They often happen in conjunction with upgrades, downgrades, cancellations, etc. but we recommend keeping the actual revenue event separate. It’s a lot simpler, especially when working with 3rd party payment systems, and for that reason it’s usually more accurate.

Below you can see our suggested best practices to track each type of event - payments (positive revenue) and refunds (negative revenue).

Payment Made

analytics.track('Payment Made', {
  plan: 'Business',
  cycle: 'Monthly',
  expires: new Date('2014-07-15T00:00:00.000Z'),
  revenue: 349

Refund Received

analytics.track('Refund Received', {
  plan: 'Startup',
  reason: 'Dissatisfied',
  revenue: -79


Gaming purchases are usually similar to e-commerce. The customer completes the transaction while they are present on your site or app. The purchase might be a license or in-app purchases. Either way we recommend tracking transactions with our e-commerce api.

Digital Products

Revenue from digital products is tracked just like e-commerce revenue. Your customer might be buying a digital download, access to a private website, or a software license. Our e-commerce API is the best practice for those on-site or in-app purchases.

Server Side

There are a few good reasons to track revenue from your server. The main thing to remember is that when you track from your servers some of our integrations can’t accept that data. Ad networks, for example, rely on client-side javascript to fire theiradvertising-conversions">conversions pixels.

Here are the main benefits of server side tracking:


Revenue events are more reliable when tracked through our server-side libraries. Browsers are pretty unpredictable - you never know what type of browsers people are using, or maybe they have opted out of analytics tracking. Server-side tracking bypasses these variables so it’s a much cleaner path to Segment and then to your analytics and marketing tools.


When you track from our server-side libraries the whole process is more secure and invisible to the end user. That means you can include things like costs, suppliers, or other data you probably wouldn’t expose to the client.

Customer Not Present

The main reason people track revenue from their servers is simply because their customers are not present when the transaction is processed. This is common in recurring revenue models.

Check out our server-side vs. client-side tracking best practices for more details.

Recommended Reading

Reply Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular