Experiments
An experiment, or test, shows different versions of a page to different visitors and measures which does better. Build one in a single call or in parts, then start it.
List experiments
Returns the project's tests, oldest first. Each one comes without its variations, targeting and goals; fetch a single test for those.
Create an experiment
Creates a draft. Only `name`, `type` and `page_url` are required, and the draft opens the way the dashboard opens one: an Original, one placeholder variation and targeting for the page. Anything else may be sent in the same call, under the same names the update calls use: `variations`, `allocation` and `split` (as in Replace variations), `primary` and `secondary` (as in Replace goals), `audience` or `conditions` (as in Replace targeting). All or nothing: a refusal in any part creates nothing. Needs an `editor` or `publisher` key.
Get an experiment
Returns one test with its variations, each variation's page changes, its targeting and its goals.
Update an experiment
Changes the fields you send and leaves the rest. A running or paused test can be edited, as in the dashboard, and its `status` is how you know visitors have already been counted against the old setup. Once a test has started, its `certainty` is fixed. A stopped or archived test cannot be edited. Variations, goals and targeting have their own calls. Needs an `editor` or `publisher` key.
Duplicate an experiment
Makes a new draft with the same variations, changes, targeting and goals, and none of the results. This is how to try the same idea again after a test has stopped. Needs an `editor` or `publisher` key, and a plan that includes the test's kind.
Replace variations
Replaces the whole list of variations. Send only what you are testing: the Original is added in front for you. A variation sent with its `id` keeps the visitors already assigned to it; one sent without an `id` is new, and one left out is removed. On an A/B test each variation carries its page `changes`; on a split URL test, its `url`; an A/A check takes only `allocation`. On a running or paused test, send every variation with its `id`, in the same order, with the same `split`: you can still rename them, move the baseline and change `allocation`, but adding, removing or reordering a variation, or changing the split, is refused with a 422, because it would move visitors already in the test. Needs an `editor` or `publisher` key.
Replace goals
Sets the metric the test is decided on (`primary`) and the ones watched while it runs (`secondary`). The whole list is replaced: leaving out `secondary` means none. Guardrails are not changed here; the choices made in the dashboard stay as they are. Changing the deciding metric on a running test is allowed, as in the dashboard, and is written to the audit log. Needs an `editor` or `publisher` key.
Replace targeting
Sets who the test is shown to: a saved `audience` by its `id`, or `conditions` written for this test, never both. A saved audience's conditions are copied onto the test, so editing the audience later never changes this test. Send neither to show the test to everybody. The pages the test runs on are not changed here. Needs an `editor` or `publisher` key.
Change an experiment's status
Starts, pauses, resumes, stops or archives a test, after the same checks the dashboard's own buttons make. One call takes all five, named in `action`.