If you have custom events that you want to bill on, or have observability on, you can ingest your raw events directly through the Track Action API. This can be done from an event stream such as AWS Firehose and Logstash. Select an integration option below.
Actions have an action name (like “Signed Up” or “Finished Data Processing Job”) which represents the name of the raw event. You can also include arbitrary metadata with an action which enables you to create billable metrics, usage reporting, and more. For more info, see docs on actions.
An example action is below:
{
"action_name": "Finished Data Processing Job",
"request": {
"time": "2025-01-28T04:45:42.914"
},
"company_id": "12345",
"metadata": {
"total_rows": 1024,
"found_rows": 999,
"consumed_input_tokens": 54322,
"time_seconds": 66.3
}
}
In the above example, the action is created whenever abackend data job finishes. There are also two metrics we are tracking as part of the action (the amount of the payment and how long the job took). You can create billable metrics and usage reports from these attributes.
Moesif recommends setting the optional field transaction_id
to a random 36 character UUID such as 123e4567-e89b-12d3-a456-426614174000
. Moesif uses the transaction_id
for ensuring duplicate events are not created.
Event-based billing
Moesif is designed to ingest your raw events at very high volume. Because of this, we strongly recommend not pre-aggregating the events. Otherwise, you lose fidelity and resolution of your usage data. For example, Moesif can trace exactly which events are part of which billing period or invoice. Do note, Moesif has a hard limit of 1MB per event.