mteb/leaderboard-analytics-service
1
Leaderboard Analytics Metrics Spec
This project analyzes user behavior on the MTEB leaderboard page from event logs in MongoDB.
The primary purpose of this document is to define what is measured, where each metric comes from, and how each metric is calculated.
Data Contract
All analytics are based on the events collection and the following stable fields:
- Core dimensions:
event_name,timestamp,session_id - Behavior context:
benchmark,filters - Visitor identity (approximate):
properties.visitor_id - Change context:
properties.old_value,properties.new_value,properties.filter_name
Important event names:
page_viewbenchmark_changefilter_change_* (dynamic names, such asfilter_change_task_type)table_download(currently may be missing in some deployments)
Metrics Dictionary
1) PV (Page Views)
- Definition: Number of page view events.
- Source fields:
event_name - Calculation:
- Filter events where
event_name == "page_view" - PV = count of matched events
2) Sessions
- Definition: Number of unique interaction sessions.
- Source fields:
session_id - Calculation:
- Sessions = count of distinct
session_idin the selected time range
3) UV (Unique Visitors, Approximate)
- Definition: Number of unique visitors identified by hashed fingerprint.
- Source fields:
properties.visitor_id - Calculation:
- Remove null/empty
properties.visitor_id - UV = count of distinct
properties.visitor_id
4) Sessions Per Visitor
- Definition: Average number of sessions per visitor.
- Source fields: derived from Sessions and UV
- Calculation:
- Sessions Per Visitor =
Sessions / UV - If UV is 0, result is 0
5) Session Depth (Events Per Session)
- Definition: Average interaction intensity per session.
- Source fields: all events,
session_id - Calculation:
- Total Events = count of all events in range
- Session Depth =
Total Events / Sessions - If Sessions is 0, result is 0
Behavior Metrics
6) Benchmark Popularity
- Definition: Frequency of selected benchmarks.
- Source fields:
event_name,properties.new_value - Calculation:
- Filter
event_name == "benchmark_change" - Group by
properties.new_value - Popularity = event count per benchmark value
7) Filter Usage Distribution
- Definition: Usage volume by filter event type.
- Source fields:
event_name - Calculation:
- Filter
event_namematching regex^filter_change_ - Group by
event_name - Distribution = count per filter event
8) Filter Session Coverage
- Definition: Number of sessions that used each filter type.
- Source fields:
event_name,session_id - Calculation:
- For each
filter_change_* event type: - collect distinct
session_id - coverage = distinct session count
Funnel Metrics
Recommended session-level funnel:
page_viewbenchmark_changefilter_change_*table_download
9) Step Session Count
- Definition: Number of sessions that reached each funnel step.
- Source fields:
session_id,event_name - Calculation:
- Group events by
session_id - For each session, mark whether each step exists
- Count sessions satisfying each cumulative step condition
10) Step Conversion Rate
- Definition: Conversion from funnel step 1 (
page_view) to each step. - Source fields: derived from Step Session Count
- Calculation:
- Conversion Rate(step N) =
StepN Sessions / Step1 Sessions * 100% - If Step1 Sessions is 0, result is 0%
Visitor Segmentation Metrics
11) New Visitors
- Definition: Visitors whose current period contains their first observed visit date.
- Source fields:
event_name,timestamp,properties.visitor_id - Calculation:
- Use
page_viewevents only - For each
visitor_id, find earliest timestamp (first_seen) - If event date equals
first_seendate, classify asnew - Count distinct
visitor_idby period
12) Returning Visitors
- Definition: Visitors seen after their first observed date.
- Source fields: same as New Visitors
- Calculation:
- Use same first-seen logic
- If event date is later than first-seen date, classify as
returning - Count distinct
visitor_idby period
Time Aggregation Rules
All trend metrics support these granularities:
day->%Y-%m-%dweek->%G-W%V(ISO week)month->%Y-%m
Time filtering is applied on converted event time:
- Convert
timestampto datetime (ts) - Keep records where
start_time <= ts <= end_time
Optional benchmark filtering:
- If benchmark filter is provided, add
benchmark == <value>to match conditions
Data Quality Notes
visitor_idis an approximate identifier, not a strict user identity.- For
filter_change_*,properties.new_valuemay not always represent the actual final filter value; preferfilterssnapshot for behavioral context. - If
table_downloadis not instrumented, funnel step 4 will under-report by design.
Minimal Runtime Notes
Only required runtime inputs:
- MongoDB connection URI (
MONGO_URI) - Mongo database/collection names (defaults supported)
Local commands:
uv sync
uv run leaderboard-analytics