Track billing events in your SaaS

Learn how to capture and monitor billing events in your SaaS app using Operational for clearer insights and smoother revenue tracking.

What is billing event tracking in SaaS

Tracking billing events means capturing actions like payments, failures, or subscription changes. It helps you monitor revenue flow and detect issues fast. For example, if a customer card fails, you can alert support and retry the charge.

Why use Operational for billing events

Operational is a lightweight tracking tool for any event in your app. You can send billing events to its dashboard and see them in real time.

Operational in action

Setting up Operational

  1. Go to https://app.operational.co and create an account.
  2. Set up a new project and copy your API key.
  3. Install the SDK:
    npm install @operational.co/sdk
  4. Add your API key to your environment, for example:
    export OPERATIONAL_API_KEY="your_api_key"

Tracking billing events in code

import Operational from "@operational.co/sdk";
const ops = new Operational("API_KEY");

// Billing success event
await ops.events.ingest({
  name: "billing_success",
  avatar: "💳",
  content: "Subscription billed for $20 for John Smith"
});

// Billing failure event
await ops.events.ingest({
  name: "billing_failure",
  avatar: "💳",
  content: "Payment failed for $15 for Jane Doe"
});

// Subscription upgrade event
await ops.events.ingest({
  name: "subscription_upgrade",
  avatar: "💳",
  content: "User John Smith upgraded to Pro plan"
});

This code logs different billing events so you can watch them in your dashboard.

Conclusion

Tracking billing events with Operational saves you time and reduces errors. Learn more at https://operational.co and try the Playground at https://operational.co/playground.