Skip to main content

Metrics

Metrics define what exactly your widgets measure. Metriox supports four metrics, and together they cover most analytics scenarios.

Core metrics

1. Events

Counts the total number of events.

Formula: COUNT(events)

When to use it:

  • Overall activity in the bot
  • How often an action happens
  • How much a feature is used

Examples:

QuestionMetricFilterResult
How many times was the "Buy" button clicked?EventsEvent equals "button_click" AND props.button_name equals "buy"1,542 events
How many messages were sent in a day?EventsEvent equals "message_sent"12,345 events

Details:

  • A single user can generate many events
  • It says nothing about how many users are behind them
  • Useful for measuring usage intensity

Widgets:

  • Series: how the event count changes over time
  • Top: the most frequent events
  • KPI: the total for the period
  • Table: a breakdown by category

2. Users

Counts the number of unique people who did something themselves during the period.

Not counted: recipients of messages the bot sent (a broadcast does not make someone active), the bot itself, and rows with no identifiable author. In a group, every member who posted is counted rather than the group. See Vitals.

Formula: COUNT(DISTINCT event author), where the author comes from $tg.from_id, falling back to platform_user_id when it is absent

When to use it:

  • Active user counts (DAU, MAU)
  • Audience reach
  • Whether an action is unique per user

Examples:

QuestionMetricFilterTime rangeResult
How many users bought a subscription?Users(prop) tg.callback_data (op) equals "purchase_completed"342 users
DAU (Daily Active Users)Usersany eventsthe range you select3,542 users
User activityEvents per Userany eventslast 24 hours12,51 events per user

Details:

  • Every user is counted only once
  • It is the basis for conversion calculations
  • Important for sizing your audience

Widgets:

  • KPI: active users
  • Series: DAU/MAU over time
  • Funnel: conversion between steps
  • Top: the most active users (by user_id)

3. Events per User

Calculates the average number of events per unique user.

Formula: COUNT(events) / COUNT(DISTINCT platform_user_id)

When to use it:

  • Usage intensity
  • Engagement
  • Comparing activity across segments

Examples:

QuestionMetricFilterResult
How many messages does a user send on average?Events per UserEvent equals "message_sent"8.7 events per user

Details:

  • Shows how deeply users engage
  • Normalizes metrics across segments
  • Can be a fractional number

Widgets:

  • KPI: average activity
  • Series: engagement over time
  • Table: segment comparison
  • Top: groups by activity

4. Sum

Adds up the values of a single numeric property — payment totals, for example.

Formula: SUM(property value) over the events of one source

Unlike the other metrics, Sum needs two settings:

  • Property — which numeric field to add up, e.g. $tg.total_amount. Only numeric properties are offered: summing a text field would not raise an error, it would quietly return zero.
  • Source — whose events to count (Bot API, the MTProto worker, Mini App).

Why the source is mandatory. If a bot is connected through both the SDK and the MTProto worker, the same payment is recorded twice — they are separate sources and they do not collapse into one record. Without pinning to a single source a money figure would double. On a bot with one source it would look perfectly correct, which is what makes the mistake so hard to notice, so the server refuses a request without a source rather than assuming one.

This does not contradict charge deduplication

Such an event is billed once — but both rows stay in storage, precisely so that a report pinned to one source still finds its data. Deduplication applies to the quota, not to the rows, which is why naming a source remains mandatory for money metrics.

Values are not converted. Sums come back exactly as Telegram sends them — in smallest units (Stars, cents), never converted between currencies. Group by $tg.currency to keep currencies apart: several correct numbers are more useful than one meaningless one.

Examples:

QuestionMetricSettingsResult
How many Stars were spent this week?Sum$tg.total_amount, Bot API source48,250
Revenue by currencySum$tg.total_amount, grouped by $tg.currencyseveral rows

Widgets: Series, Top, Table, KPI. It is unavailable on Histogram and Heatmap — there is nowhere to name the property and source there, so such a request is refused rather than quietly summed across every source.


Comparing the metrics

MetricWhat it countsWhen to use it
EventsTotal number of eventsVolume, frequency, intensity
UsersUnique usersReach, DAU/MAU, conversion
Events per UserAverage events per userEngagement
SumThe total of a numeric propertyMoney, order values, any numeric field

Comparison example

The button_click event over a 7-day period:

MetricValue
Events10,000 events
Users2,500 users
Events per User4.0 events per user

How to read it:

  • There were 10,000 clicks
  • 2,500 unique users clicked
  • On average each user clicked 4 times

Using metrics in widgets

Top widget

Available metrics:

  • Events — top events by frequency
  • Users — top events by reach
  • Events per User — top events by engagement
  • Sum — top by the total of a numeric property (revenue by currency, for example)

Example — the top 5 events by Users:

EventUsers
bot_started3,542 users
screen_view2,987 users
button_click2,314 users
purchase_viewed1,234 users
message_sent876 users

Funnel widget

Available metric:

  • Users (only)

Why only Users?

  • A funnel tracks the path users take
  • Events can repeat
  • Conversion is measured in users

Example:

StepUsersConversion
1. bot_started10,000
2. view_pricing3,50035% conversion
3. purchase_completed8508.5% from the start

Table widget

Available metrics:

  • All four metrics at once

Example:

EventEventsUsersEvents/User
button_click10,0002,5004.0
screen_view15,0003,0005.0
message_sent8,0001,0008.0

KPI widget

Available metrics:

  • Any single metric

Examples:

Key metricValueChangeMetric
DAU3,542↑ 8% vs yesterdayUsers
Average activity12.7 events/user↑ 5% vs last weekEvents per User

Histogram widget

Available metrics:

  • Events
  • Users

Sum is unavailable here: a Histogram has nowhere to name the property and source.

Example — the distribution of activity by hour of day with the Users metric.

Series widget

Available metrics:

  • All four metrics (several lines are allowed)

Practical examples

DAU, WAU, MAU

Key metricMetricFilterTime range
DAU (Daily Active Users)Usersany eventsa day
The ready-made DAU/WAU/MAU cards use completed periods

On the Vitals page these three report the last complete UTC calendar day, week and month rather than a rolling 24 hours / 7 / 30 days. In your own widget you choose the range.

| WAU (Weekly Active Users) | Users | any events | last 7 days | | MAU (Monthly Active Users) | Users | any events | last 30 days |

Purchase conversion

A funnel on the Users metric:

StepUsersShare of the start
1. bot_started10,000100%
2. view_pricing3,50035%
3. purchase_completed8508.5%

Conversion = 850 / 10,000 = 8.5%

Engagement metrics

Average number of screens per user:

MetricFilterResult
Events per UserEvent equals "screen_view"7.2 screens per user

Premium vs free activity:

SegmentEventsUsersEvents/User
Premium5,00025020.0
Free8,0002,0004.0

Premium users are 5 times more active.

Retention analysis

Counting returning users:

MetricFilterTime range
Usersprops.days_since_signup greater than 7last 24 hours

Result:

PeriodUsers
Day 01,000 new users
Day 7350 active (35% retention)

Best practices

Choosing a metric

Events:

  • How many times an action was performed
  • Total volume of activity
  • Not suitable for counting users

Users:

  • How many users performed an action
  • DAU, MAU, reach
  • Conversion funnels
  • Does not show usage intensity

Events per User:

  • How active your users are
  • Comparing engagement across segments
  • Behaviour changes over time
  • Can be skewed when the user count is small

Combining metrics

Use several metrics together for the full picture:

  • KPI dashboard
    • DAU (Users)
    • Overall activity (Events)
    • Average activity (Events per User)
  • Series chart
    • Line 1 — Users (left-hand scale)
    • Line 2 — Events per User (right-hand scale)

Interpreting results

  • Events grow while Users stay flat — your existing users became more active
  • Users grow while Events per User falls — an influx of new, less active users
  • Events and Users grow proportionally — healthy product growth

Technical details

How ClickHouse computes them

Events:

SELECT COUNT(*) FROM events WHERE ...

Users:

SELECT COUNT(DISTINCT platform_user_id) FROM events WHERE ...

Events per User:

SELECT
COUNT(*) / COUNT(DISTINCT platform_user_id)
FROM events WHERE ...

Performance

  • Events: the fastest metric
  • Users: requires deduplication (slower)
  • Events per User: two operations (the slowest)

Optimization:

  • Use filters to reduce the volume of data
  • Keep the time range narrow
  • Cache frequently used queries

What's next?

  • Filters — learn how to filter the data behind your metrics
  • Widgets — use metrics across the different widget types
  • Events — the data structure behind metrics