Skip to main content
Imagine you are a Tracking API company (such as Segment.com). For the same events received, each aggregation type returns a different result, and that result is what you charge your customers for.

Example of events received

You decided to charge the Tracked Pages. This is your billable metric. The customer is on a monthly plan, so the billing period runs from March 1 to March 31, 2022. Here are the two events sent by your backend to Lago, based on the consumption of that customer:
Event received #1
Event received #2

Differences between the aggregation types

Weighted sum is the only type whose result depends on the billing period, because it weights the running total by the time it was held. Here the total is 10 for one day (March 16 to March 17), then 30 for the remaining 15 days of March: (10 x 1 day + 30 x 15 days) / 31 days = 14.84. The amount charged to your customer depends on the aggregation type you defined for the Tracked Pages billable metric. Choose the right aggregation type for each of your billable metrics. If you need help, contact the Lago team.