Create a custom result query
Creates a custom result query, or reuses one already computed. Beta.
Every field is optional; an empty body asks the same question the snapshot read answers. Unlike that read, this one can group by any dimension, narrow the window, and scope to a product group.
Not real time. A query matching one computed within the last hour
returns that snapshot with the same id and no recomputation, and a
query identical to one already running attaches to it rather than
starting a second. So results can be up to an hour old, and polling
faster than that changes nothing.
Answers 200 when a computed snapshot already covers the query and
202 when one is being computed. Either way the body identifies the
query and carries no rows: read those from
GET /experiments/{id}/results/{query_id}.
A test that has not run yet returns 422 results_not_available:
there is no traffic to compute from until it starts.
This is a read: it derives from data you already have and changes
nothing, so a read_experiments token may call it.
Authorizations
Bearer tokens created in the ABConvert admin under
Settings → MCP & API Access. Scopes:
read_experiments and write_experiments (write implies read; the
default is read). See
Authentication for which scope each
request needs.
Path Parameters
The test's numeric ID as a string, for example "3021".
^[0-9]+$"3021"
Body
Group the rows by one or two dimensions. Order doesn't
matter: it names a query, and the same pair in either
order is the same query. Naming the same dimension twice
returns 422 duplicate_breakdown_dimension. Grouping by
product_id also needs product_group_id (that group is
what the products are resolved from), and without it the
request returns 422 product_id_requires_product_group.
1 - 2 elementsA dimension a custom result query can group by. product_id requires
product_group_id, which scopes it to that product group's products.
page_url, template, and click_destination require
metricSet: engagement.
date, country, market, device, visitor_type, traffic_channel, traffic_platform, referral_domain, landing_page, utm_source, utm_medium, utm_campaign, utm_term, utm_content, product_id, page_url, template, click_destination Selects the metric registry. engagement returns page
views, click-throughs, bounce rate, and average staying
time, and enables page/template/destination breakdowns.
Any other value returns 422 invalid_metric_set.
core, engagement Rule id for the custom-event metric the caller intends to
inspect. The query response still returns the complete
custom_events collection, so this selector needs no
query-job state and does not replace the experiment's
configured primary metric. For backward compatibility, it
also supplies the segment rule when customEventSegment
is present and customEventRuleId is omitted. An unknown
or ineligible rule returns
400 invalid_custom_event_metric. If custom-event analytics
are unavailable for the shop, the same code returns 404.
^[a-z0-9_]+$Rule id for a custom-event visitor segment. Supply together
with customEventSegment; it may differ from
customEventMetricId.
^[a-z0-9_]+$Include or exclude visitors who triggered
customEventRuleId. Supplying only one selector returns
400 invalid_custom_event_segment.
include, exclude Which visitors count. assignment includes every visitor
put in a test group; exposure only those the test
actually reached. exposure is only available on tests
measured that way; asking for it elsewhere returns 422
sample_basis_unsupported.
assignment, exposure Scope the query to one product group. Read the id from a
test's product_group; any other value returns 422
product_group_not_found.
^[a-fA-F0-9]{24}$Inclusive window, both bounds required. Defaults to the
test's own lifetime. An unknown key here returns 422
invalid_date_range.
The window is narrowed to the days that can hold data: no earlier than the day the test started, no later than today. Asking for more isn't an error. The window isn't narrowed to the day the test ended: orders count on the day they were placed, so a window past the end date picks up conversions from visitors assigned before it.
A window that can hold nothing at all (ending before the
test started, or beginning after today) returns 422
date_range_out_of_bounds.
Response
A computed snapshot already answers this query.
A custom result query job. Beta.
status is pending until the snapshot is computed, then completed
or failed. The result fields are present only when completed.
"results_query"Treat as opaque. Never parse it.
"66d3b91c4f2a7e5081c9a3b7"
"3021"
pending, completed, failed Why the query failed, in plain language. Present only when status
is failed. Run the query again; if it fails again, send support
this text and the query id.
The registry used to compute these rows.
core, engagement Custom-event analytics already computed in the snapshot.
The effective inclusive local-date window after safety clamping.
Whole-test totals. Present on a query with no breakdown; a
dimensional query answers with breakdown.rows instead, and
carries no separate totals.
Present when the query named a breakdown.