A/B tests tools

🚧

Warning

Write tools change your live configuration. Just like changes made in the Bloomreach dashboard, actions your users or agents take with these tools can have a substantial impact on your live search and category experience. There is no automatic rollback and activity logging is limited, so review every change and confirm the target before applying it.

search_discovery_experiments

Searches the A/B test experiments in an account, or fetches one by ID. Omit experiment_id to list paginated summaries — each with the experiment's name, status, traffic allocation, buckets (variants), and scheduling details. Filter by status or name to narrow the list.

Pass experiment_id to fetch the full configuration of one experiment, including its traffic allocation, buckets with rule info, success metric, and winner bucket if the experiment has completed. Use get_discovery_experiment_report for its statistical results.

Request parameters

NameTypeRequired?Description
experiment_idint | nullNoThe experiment ID. Omit to list all experiments; provide to fetch one.
account_namestr | nullNoThe account name. If you have exactly one account, it's selected for you.
site_group_idstr | int | nullNoA site group ID or site name. Defaults to the account level (-1).
pageintNoThe page number, zero-based. Defaults to 0. Ignored when experiment_id is set.
limitintNoThe number of results per page. Defaults to 10. Ignored when experiment_id is set.
sort_bystrNoThe field to sort by: MODIFIED_AT, STARTED_AT, EXPERIMENT_NAME, or ID. Defaults to MODIFIED_AT. Ignored when experiment_id is set.
sort_orderstrNoThe sort direction, ASC or DESC. Defaults to DESC. Ignored when experiment_id is set.
qstr | nullNoA search term, at least 3 characters, to filter by experiment or user name. Ignored when experiment_id is set.
experiment_statusesstr | nullNoA comma-separated list of statuses to filter by: DRAFT, RUNNING, COMPLETED, or ARCHIVED. Ignored when experiment_id is set.

Response parameters

The tool returns an ExperimentsResponse object when experiment_id is omitted (a list of summaries) or an ExperimentResponse object when experiment_id is provided (a single experiment's full configuration).

The ExperimentsResponse object has the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
datalist[ExperimentSummary]The experiments in the account.
errorstr | nullError message if the request failed.

The ExperimentSummary object has the following fields:

FieldTypeDescription
idintThe experiment's unique ID.
experimentNamestr | nullThe experiment's display name.
experimentTypestr | nullThe experiment type, targeting or testing.
experimentStatusstr | nullThe status: DRAFT, RUNNING, COMPLETED, or ARCHIVED.
isEditablebool | nullWhether the experiment can be edited.
sitegroupIdint | nullThe site group this experiment runs on.
influencestr | nullThe influence metric.
trafficPercentageint | nullThe total percentage of traffic allocated to the experiment.
startedAtint | nullUnix timestamp in milliseconds of when the experiment started.
endedAtint | nullUnix timestamp in milliseconds of when the experiment ended.
modifiedAtint | nullUnix timestamp in milliseconds of the last modification.
userstr | nullThe user who last modified the experiment.
isInternalbool | nullWhether this is an internal experiment.
notestr | nullAn optional note.
bucketslist[ExperimentBucket]The traffic buckets (variants) in the experiment.

The ExperimentBucket object has the following fields:

FieldTypeDescription
idint | nullThe bucket's ID.
bucketNamestr | nullThe bucket's display name.
trafficPercentageint | nullThe percentage of traffic routed to this bucket.
bucketDescriptionstr | nullThe bucket's description.
controlbool | nullWhether this is the control bucket.
ruleIdentifierInfoExperimentBucketRuleInfo | nullThe rule info for the variant.

The ExperimentBucketRuleInfo object has the following fields:

FieldTypeDescription
idint | nullThe rule ID.
ruleTypestr | nullThe rule type, such as ranking or redirect.
variantIdint | nullThe variant ID.
modifiedAtint | nullUnix timestamp in milliseconds of the last modification.
userstr | nullThe user who last modified the rule.
querylist[ExperimentBucketQuery]The queries associated with this rule.

The ExperimentBucketQuery object has the following fields:

FieldTypeDescription
idint | nullThe query identifier.
querystr | nullThe query text.
queryTypestr | nullThe query type, such as sitesearch or category.

When experiment_id is provided, the tool returns an ExperimentResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
dataExperimentDetail | nullThe full experiment record.
errorstr | nullError message if the request failed.

The ExperimentDetail object adds the following fields on top of the summary record:

FieldTypeDescription
successMetricstr | nullThe success metric: AOV - Average Order Value, ATC Rate - Add to Cart Rate, CR - Conversion Rate, or RPV - Revenue Per Visit.
winnerBucketIdint | nullThe ID of the winning bucket, set when the experiment completes.

get_discovery_experiment_report

Returns the analytics report for an experiment. The report shows performance metrics such as visitors, conversions, revenue, and statistical confidence, comparing the test buckets against a control bucket over a date range.

Every parameter is required. Use search_discovery_experiments first to obtain the bucket names and dates.

Request parameters

NameTypeRequired?Description
experiment_idintYesThe experiment ID.
start_datestrYesThe start date in YYYYMMDD format, for example 20240101.
end_datestrYesThe end date in YYYYMMDD format, for example 20240131.
test_bucketsstrYesA comma-separated list of test bucket names.
control_bucketstrYesThe control bucket name.
experiment_session_typestrYesThe session type: SEARCH, CATEGORY, or GLOBAL.
experiment_namestrYesThe experiment name. Must match exactly.

Response parameters

The tool returns an ExperimentReportResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the request succeeded.
dataany | nullThe report data, returned as freeform JSON from the analytics backend.
errorstr | nullError message if the request failed.

create_discovery_experiment

Creates a new A/B test experiment. Experiments follow a strict lifecycle: create, then start_discovery_experiment, then end_discovery_experiment, then archive_discovery_experiment. You can't skip steps. Because the experiment is created in draft state, no live traffic is affected until you start it.

Each bucket links to a rule variant. Exactly one bucket must be the control, the bucket traffic_percentage values must sum to 100, and an experiment can have at most four buckets including the control. You can build two patterns. In a rule-versus-default test, the control bucket has no customization_id and represents the default search behavior, while the test bucket sets customization_id to a rule ID. In a rule-A-versus-rule-B test, both buckets point to rule variants. Set success_metric to record your goal for reference, though the test doesn't use it to determine a winner. You decide the winner yourself from the results.

Request parameters

NameTypeRequired?Description
namestrYesThe display name for the experiment, such as Search terms - dress. May contain only alphanumeric characters, spaces, underscores, and hyphens.
traffic_percentageintYesThe percentage of eligible traffic to include in the test, from 0 to 100. 100 means all eligible traffic participates.
bucketslist[dict]YesThe test buckets. Each entry needs bucket_name (alphanumeric, spaces, underscores, and hyphens only), traffic_percentage (all buckets must sum to 100), control (exactly one bucket must be True), and optionally customization_id (omit for the default control bucket).
account_namestr | nullNoThe account name. Auto-selected if you have exactly one account.
site_group_idstr | int | nullNoA site group ID or site name. Defaults to the account level (-1).
success_metricstr | nullNoThe success metric: AOV (Average Order Value), ATC_RATE (Add to Cart Rate), CR (Conversion Rate), or RPV (Revenue Per Visit). Strongly recommended.
notestr | nullNoAn optional note for the experiment.

Response parameters

The tool returns an ExperimentMutationResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the operation succeeded.
dataany | nullThe created experiment as freeform JSON. Use the returned id for later start_discovery_experiment, end_discovery_experiment, or archive_discovery_experiment calls.
errorstr | nullError message if the operation failed.

start_discovery_experiment

Starts a draft experiment and moves it to running status. The traffic split begins the moment this call returns, so the experiment goes live immediately with no asynchronous buffer. All variant customizations are set live and enabled, so make sure every variant rule is correctly configured and enabled before you start.

Only draft experiments can be started. Once an experiment is running, only end_discovery_experiment can stop the traffic split.

Request parameters

NameTypeRequired?Description
experiment_idintYesThe ID of the draft experiment to start. Use search_discovery_experiments to find the ID.
account_namestr | nullNoThe account name. Auto-selected if you have exactly one account.
site_group_idstr | int | nullNoA site group ID or site name. Defaults to the account level (-1).

Response parameters

The tool returns an ExperimentMutationResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the operation succeeded.
dataany | nullThe updated experiment state as freeform JSON.
errorstr | nullError message if the operation failed.

end_discovery_experiment

Ends a running experiment and moves it to completed status. This takes effect immediately and can't be restarted. If you provide winner_bucket_id, that variant goes live to 100% of traffic the moment the call returns and all other variants are disabled. If you omit it, all variants are disabled and traffic reverts to the default behavior.

Only running experiments can be ended. Ending without a winner isn't supported when the test uses Global recall algorithm rules or when the default behavior control bucket, with no customization_id, is one of the buckets. In a rule-versus-default test you must always declare a winner. To archive after completion, use archive_discovery_experiment.

Request parameters

NameTypeRequired?Description
experiment_idintYesThe ID of the running experiment to end.
account_namestr | nullNoThe account name. Auto-selected if you have exactly one account.
site_group_idstr | int | nullNoA site group ID or site name. Defaults to the account level (-1).
winner_bucket_idint | nullNoThe ID of the winning bucket, which goes live to 100% of traffic immediately. Omit to end without a winner and revert traffic to the default. Use search_discovery_experiments to find bucket IDs.

Response parameters

The tool returns an ExperimentMutationResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the operation succeeded.
dataany | nullThe updated experiment state as freeform JSON.
errorstr | nullError message if the operation failed.

archive_discovery_experiment

Archives a completed experiment. Archiving hides the experiment from the default dashboard view and has no live impact, since it's a visibility change only. You can unarchive an experiment later from the Discovery dashboard.

Only completed experiments can be archived.

Request parameters

NameTypeRequired?Description
experiment_idintYesThe ID of the completed experiment to archive.
account_namestr | nullNoThe account name. Auto-selected if you have exactly one account.
site_group_idstr | int | nullNoA site group ID or site name. Defaults to the account level (-1).

Response parameters

The tool returns an ExperimentMutationResponse object with the following parameters:

ParameterTypeDescription
successboolWhether the operation succeeded.
dataany | nullThe updated experiment state as freeform JSON.
errorstr | nullError message if the operation failed.


Did this page help you?

© Bloomreach, Inc. All rights reserved.