Custom metrics
A custom metric is a saved lens over the events you already track. It does not add new tracking. It tells Versuch how to roll a tracked event up into a number: which event to read, how to aggregate it, which direction is good, and how to format it.
Because metrics are computed at analysis time, defining one is retroactive: it applies to events already in the store, not just events sent after you create it.
The definition shape
Section titled “The definition shape”{ "name": "Checkout revenue", "key": "checkout_revenue", "description": "Revenue per exposed visitor from checkout events", "event": "checkout", "aggregation": "sum", "direction": "higher", "format": "usd"}| Field | What it does |
|---|---|
name | Human label shown in the dashboard and results. Required. |
key | Stable id used by the API. Auto-generated from name if omitted. |
description | Optional note describing what the metric measures. |
event | The tracked event name this metric aggregates (for example checkout, signup). Required. |
aggregation | sum, mean, count, or conversion. |
direction | higher or lower: which way is a win. |
format | usd, percent, seconds, or number: how the value renders. |
Aggregation types
Section titled “Aggregation types”conversion: the share of exposed visitors who fired the event at least once. Use for signup rate, purchase rate, activation.count: how many times the event fired per visitor. Use for events per session, actions taken.sum: the total of the event’svalueacross a visitor. Use for revenue, total items.mean: the averagevalueper event. Use for average order value, average time.
sum and mean read the event’s value field, so make sure you send a value when you track those events. Values are in minor units (cents), and usd formatting divides accordingly.
Direction
Section titled “Direction”direction tells the stats engine which way counts as an improvement. For revenue and signups that is higher. For refunds, latency, or churn that is lower. Results read the significance against control in the correct direction, so a metric where lower is better does not get flagged as a loss for going down.
Create a metric
Section titled “Create a metric”POST https://versuch.ai/api/v1/metrics with a secret key.
curl -X POST https://versuch.ai/api/v1/metrics \ -H "Authorization: Bearer vsk_live_…" \ -H "Content-Type: application/json" \ -d '{ "name": "Checkout revenue", "description": "Revenue per exposed visitor from checkout events", "event": "checkout", "aggregation": "sum", "direction": "higher", "format": "usd" }'List and delete:
# List all metric definitionscurl https://versuch.ai/api/v1/metrics \ -H "Authorization: Bearer vsk_live_…"
# Delete a metric (also detaches it from any experiments)curl -X DELETE https://versuch.ai/api/v1/metrics/checkout_revenue \ -H "Authorization: Bearer vsk_live_…"Deleting a metric detaches it from every experiment it was attached to. The underlying events are untouched.
-
Open your project and go to Metrics, then New metric.
-
Enter a name and pick the event it aggregates.
-
Choose the aggregation (
conversion,count,sum, ormean), the direction, and the display format. -
Save. The metric is immediately available to attach to experiments.
Attach a metric to an experiment
Section titled “Attach a metric to an experiment”A metric only affects results once it is attached to an experiment. Attach a primary metric and optional guardrails:
curl -X PUT https://versuch.ai/api/v1/experiments/exp_123/metrics \ -H "Authorization: Bearer vsk_live_…" \ -H "Content-Type: application/json" \ -d '{ "primary": "checkout_revenue", "guardrails": ["signup_rate", "refund_rate"] }'primary: the metric the experiment is decided on.guardrails: metrics you want to watch for regressions while the primary moves. A guardrail withdirection: "lower"(likerefund_rate) flags if it goes up.
Once attached, results show direction-aware significance per metric: the primary drives the call, and each guardrail is reported alongside so you can see the trade-offs.