Metric Types
Metric calculation types (reference)
This page lists the numeric enums that define how a metric is counted and whether “up” or “down” is a win. A metric is a success definition (“how many unique visitors clicked Buy?”). The calculation type is the counting rule; property aggregation is the extra rule when you count a numeric field on the event (sum of revenue, average order value); direction says whether higher or lower is better.
Source: lib/enums.ts — METRIC_CALCULATION_TYPE, METRIC_PROPERTY_VALUE_TYPE, METRIC_DIRECTION. Doc ID: ref.metric-types. Audience: both.
Words used on this page
| Word | Everyday meaning | Meaning in CROForge |
|---|---|---|
| Metric | A numbered goal (conversion rate, revenue, bounce). | A Data Vista object: an event + conditions + calculation type + optional property aggregation + direction. Attached to experiments as experiment metrics. |
| Enum | A labeled list of allowed values in code. | METRIC_CALCULATION_TYPE 0–3, METRIC_PROPERTY_VALUE_TYPE 0–5, METRIC_DIRECTION Up 0 / Down 1. |
| Unique visitor | Count each person once, even if they click ten times. | METRIC_CALCULATION_TYPE.UNIQUE_VISITOR = 0. Distinct visitors who meet the metric (uses visitor UUID). |
| Unique session | Count each visit once, not each person across days. | METRIC_CALCULATION_TYPE.UNIQUE_SESSION = 1. Distinct sessions (session UUID). |
| Event count | Count every matching happening, including repeats. | METRIC_CALCULATION_TYPE.EVENT_COUNT = 2. |
| Value of event property | Do math on a number attached to the event (price, duration). | METRIC_CALCULATION_TYPE.VALUE_OF_EVENT_PROPERTY = 3. Then apply METRIC_PROPERTY_VALUE_TYPE (first, last, sum, avg, min, max). |
| Aggregation | Combining many numbers into one (sum, average, min, max). | METRIC_PROPERTY_VALUE_TYPE: First 0, Last 1, Sum 2, Avg 3, Min 4, Max 5. |
| Direction | Which way is “winning” on a scoreboard. | METRIC_DIRECTION.UP = 0 (higher is better), DOWN = 1 (lower is better, e.g. bounce, errors). |
Screenshot filename
Suggested screenshot filename: metrics-list.png or experiment-metrics.png. Capture the metric create/edit form showing calculation type and direction. Insert the real image from the WordPress Media Library in place of this note.
Calculation (METRIC_CALCULATION_TYPE)
Pick one counting rule per metric. Values are integers 0–3.
| Name | Value | Meaning |
|---|---|---|
| Unique visitor | 0 | Count distinct visitors who meet the metric |
| Unique session | 1 | Count distinct sessions |
| Event count | 2 | Count matching events |
| Value of event property | 3 | Aggregate a numeric property |
Property aggregation (METRIC_PROPERTY_VALUE_TYPE)
Used when calculation = value of event property (enum 3). Values are integers 0–5.
| Name | Value |
|---|---|
| First value | 0 |
| Last value | 1 |
| Sum | 2 |
| Avg | 3 |
| Min | 4 |
| Max | 5 |
Direction (METRIC_DIRECTION)
| Name | Value | Meaning |
|---|---|---|
| Up | 0 | Higher is better |
| Down | 1 | Lower is better (e.g. bounce, errors) |