Skip to main content

Get Experiment Metrics

GET/v2/project/{project_key}/experiment/{test_id}/metrics

Return dashboard-parity secondary metric rows for an experiment, with optional metric selection, date filtering, and dashboard-compatible filters.

Path parameters

ParameterDescription
project_keyYour project's API key
test_idThe numeric experiment ID

Query parameters

ParameterTypeDescription
metric_keysstring | arrayMetric or goal keys to retrieve instead of all attached secondary metrics. Accepts a comma-separated string or JSON array.
goal_keysstring | arrayGoal keys to retrieve as secondary metrics. Alias for metric_keys when goals are known.
start_datestringFilter conversions from this date. Format: YYYY-MM-DD.
end_datestringFilter conversions through this date. Format: YYYY-MM-DD.
filter_bystringDashboard preset segment filter such as mobile, desktop, new, returning, paid, search, direct, or country-US.
custom_filterstring | arrayDashboard custom segment rules in the same nested rule shape used by the dashboard segment builder.
metric_batchstring | arrayOptional zero-based dashboard metric indexes to compute.
tzstringDashboard timezone hour offset used for date filtering. Defaults to 0.

All query parameters are optional. When metric_keys and goal_keys are omitted, Mida reads the experiment's attached secondary metrics from test.metric. Metric rows are produced by the same backend route as the Mida dashboard (/abtest/metrics). Metrics supports date range filters, single-sided dates, filter_by, custom_filter, metric_keys/goal_keys, and metric_batch.

Metrics breakdowns

The dashboard metrics engine does not support breakdown_by yet. Requests that include breakdown_by return 400.

Supported filters

  • filter_by: dashboard preset segments. Comma-separated tokens across dimensions are AND; multiple country-XX tokens are OR within country (desktop,country-US,country-CA = Desktop AND (US OR CA)).
  • custom_filter: same nested AND/OR shape as the dashboard's Custom Segment form. See Get experiment result › custom_filter criteria for the full criteria/operator table. Common criteria: landing_page, ref_page, queryparam, source, os, browser, user_agent, device, dayofweek, hourofday, visitor_type, country (ISO-2 uppercase), v.visitor_id, v.uuid, attribute, utm.

Examples

Get all attached secondary metrics:

curl "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/experiment/1234/metrics" \
-H "Authorization: Bearer YOUR_GENERATED_API_KEY"

Get specific goals in a date range:

curl -G "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/experiment/1234/metrics" \
-H "Authorization: Bearer YOUR_GENERATED_API_KEY" \
--data-urlencode 'goal_keys=purchase,signup' \
--data-urlencode 'start_date=2024-01-15' \
--data-urlencode 'end_date=2024-02-15'

Filter secondary metrics to mobile traffic:

curl -G "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/experiment/1234/metrics" \
-H "Authorization: Bearer YOUR_GENERATED_API_KEY" \
--data-urlencode 'filter_by=mobile'

Filter secondary metrics to Desktop AND US visitors:

curl -G "https://api-{region}.mida.so/v2/project/YOUR_PROJECT_KEY/experiment/1234/metrics" \
-H "Authorization: Bearer YOUR_GENERATED_API_KEY" \
--data-urlencode 'custom_filter=[[{"criteria":"device","operator":"==","value":"desktop"}],[{"criteria":"country","operator":"==","value":"US"}]]'

Success response

{
"success": true,
"test_id": 1234,
"test_name": "Homepage CTA Button Color Test",
"count": 2,
"metric_count": 1,
"metric_definitions": [
{
"metric_key": "purchase",
"metric_text": "goal_purchase",
"name": "Purchase",
"type": 2,
"goal": {
"goal_key": "purchase",
"goal_name": "Purchase",
"goal_type": "revenue",
"goal_value": "Purchase"
}
}
],
"metrics": [
{
"variant_id": "0",
"total": 1500,
"result_1": 40
},
{
"variant_id": "1",
"total": 1480,
"result_1": 52
}
]
}

Response fields

FieldTypeDescription
test_idintegerUnique experiment ID
test_namestringExperiment name
countintegerNumber of dashboard metric rows returned
metric_countintegerNumber of metric definitions requested
metric_definitionsarrayMetric definitions used to build the dashboard /metrics request
metricsarrayDashboard metric rows. Each row includes variant_id, total, and result_N fields for requested metric indexes.
filter_bystringApplied dashboard preset filter, present when used
custom_filterstring | arrayApplied dashboard custom segment rules, present when used
warningsarrayNon-fatal warnings for unsupported or missing metric definitions

Metric row fields

FieldTypeDescription
variant_idstringVariant identifier ("0" = control)
totalintegerDashboard visitor count for the row
result_NnumberDashboard metric result for the Nth metric definition. Public V2 does not synthesize conversion rates that /abtest/metrics does not return.

Error responses

StatusMeaning
400Invalid test_id, malformed query parameters, unsupported filters, unsupported breakdown_by, use of structured filters, or date parameters are malformed / out of order
401Invalid or missing API key
404Experiment not found or belongs to a different project
Next step

Need the primary goal result? Use Get Experiment Result.