Metric Types

Documents / Reference

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.tsMETRIC_CALCULATION_TYPE, METRIC_PROPERTY_VALUE_TYPE, METRIC_DIRECTION. Doc ID: ref.metric-types. Audience: both.

Words used on this page

WordEveryday meaningMeaning in CROForge
MetricA 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.
EnumA 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 visitorCount 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 sessionCount each visit once, not each person across days.METRIC_CALCULATION_TYPE.UNIQUE_SESSION = 1. Distinct sessions (session UUID).
Event countCount every matching happening, including repeats.METRIC_CALCULATION_TYPE.EVENT_COUNT = 2.
Value of event propertyDo 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).
AggregationCombining many numbers into one (sum, average, min, max).METRIC_PROPERTY_VALUE_TYPE: First 0, Last 1, Sum 2, Avg 3, Min 4, Max 5.
DirectionWhich 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.

NameValueMeaning
Unique visitor0Count distinct visitors who meet the metric
Unique session1Count distinct sessions
Event count2Count matching events
Value of event property3Aggregate a numeric property

Property aggregation (METRIC_PROPERTY_VALUE_TYPE)

Used when calculation = value of event property (enum 3). Values are integers 0–5.

NameValue
First value0
Last value1
Sum2
Avg3
Min4
Max5

Direction (METRIC_DIRECTION)

NameValueMeaning
Up0Higher is better
Down1Lower is better (e.g. bounce, errors)

Related reading