In Sequence we use Metrics and Events to enable Usage-Based Billing (UBB) and financial insights.

Usage-Based Billing can be combined with other Sequence pricing models to create a complete billing solution.

Set up your first Metric and Events in a few minutes, and lay the foundation for your usage based billing engine. View your events on the dashboard and see how to optimize what you measure via our Insights.


What is Usage-Based Billing?

Usage-Based Billing is any pricing model where the charge to the customer varies depending on how much, and how, the product is used. For example, API providers may charge per API call, SaaS platforms may charge per active seat, and payment processors may charge a percent fee on each transaction.


What are Events?

Events are the building blocks of Usage Based Billing. An event is a record of a customer action. Events are the raw data that can be used in calculating usage metrics, and ultimately are what is used to generate invoices.

Events in Sequence

Events in Sequence are made up of:

  • Event type
  • Properties of this event
  • Timestamp
  • Customer

You can have as many event types as you want. They should cover any action that would be used to calculate usage. Events are agnostic of the metric they are used for. For example, events with event type message_sent could be used to calculate the metric Total length of sent messages or Total number of sent messages. You can have as many properties as you want on the event. For each property on the event, you’ll submit the amount or value of this property, which is what will be used in usage metric calculations.

It’s best to catch all the relevant data you can, and if you need to filter the data down, you can filter it later when you define the metric using property filters.

Event Types

Event types dictate which events can be aggregated together in a metric. Events of the same type can, events of different types can’t (they are like “apples and oranges”). You can define multiple metrics on the same event type (i.e. aggregated events of the same type in multiple ways).

Set your Customer Alias

You need to tell Sequence which customer that event belongs to. This is captured by the customer alias field. You can use the Sequence customer ID as the customer alias (in which case there’s nothing else to do), but you can also use your internal identifier for that customer, as long as you have added it as an alias to the Sequence customer object. This is more convenient if the context from which you are sending the event doesn’t have access to the Sequence identifier for that customer.


We realize that while manually testing the events is simple in the dashboard, it is not a scalable solution. We will work with you to enable accurate and reliable streaming of your billable events into Sequence.

Create your first event

Learn how to create your first event in our Sandbox.


Go to the events tab in the dashboard Event in dashboard

The event message_sent could be defined as:

{
  "id": "0184421a-8202-70ea-a729-30308a40bbf7",
  "customerEventId": "event-id-H4twuTWpYx1rkd8OMTki2hTUcZ",
  "customerAlias": "customer-id-2H4u5BBwBWsS5V2sroRFqJfTXpW",
  "eventType": "message-sent",
  "sequenceAccountId": "af9b5988-1d7b-45f6-a188-326df5e59b24",
  "eventTimestamp": "2022-10-01T00:00:00Z",
  "eventProperties": {
    "length": 500,
    "type": "text_message"
  }
}

Example events include:

  • Twilio - SMS message sent - sms_sent
  • Stripe - Payment processed - payment_processed
  • Datadog - API call - api_call

Using events for Insights

With Sequence, you can now ingest events not only for usage-based billing, but also for analytics using our Insights feature.

Sequence’s Insights feature allows you to gain insights into your financial operations by analyzing the usage data of your products and services. With this feature, you can easily monitor the performance of your products and services and make data-driven decisions to optimize your financial operations.

Financial insights include metric such as:

  • Monthly Recurring Revenue (MMR)
  • Annual Recurring Revenue (ARR)
  • Top customers by monthly revenue
  • Top products by monthly revenue
  • Net revenue retention (NRR)

What are Metrics?

A metric is a formula that describes how to calculate the usage of a product. It is a function that takes events as input and produces a number as output.

For example, in a cloud computing service, the customer is charged based on the number of server hours used, the amount of storage space used, or the number of API calls made.

Think of usage metrics as measuring value creation in your product. This is powerful as it generates strong alignment and positive feedback loops across product, sales and your customers.

Example metrics include:

  • Twilio - SMS messages sent - sms_sent
  • Stripe - Payments processed - payments_processed
  • Datadog - API calls - api_calls

Metrics in Sequence

Made up of:

  • eventType - The type of event that the metric is based on
  • aggregationType - The type of aggregation to apply to the metric
  • metricType - Can be simple or grouped

Setting up your first Metric

Get started by testing your first usage based billing metric in our Sandbox.

To go straight to the API reference, see the Usage endpoints - Create metric

View them at the metrics tab in the dashboard Metric from dashboard

The metric Total length of sent messages could be defined as:

{
  "id": "f092246c-6b90-4106-bcca-304ccf06bf45",
  "sequenceAccountId": "ec1479a2-6ba1-421f-a7de-0853a20d17a1",
  "name": "Total length of sent messages",
  "metricType": "GROUPED",
  "eventType": "message_sent",
  "aggregationType": "COUNT",
  "aggregationProperty": "message_length",
  "groupingProperty": "channel",
  "unit": "bytes",
  "createdAt": "2022-06-28T16:47:00Z",
  "propertyFilters": {
    "channels": [
      "text",
      "email"
    ]
  }
}