v4
latestOpenAPI 3.0.02026-08-04109113304.5 KBUpdate an Experiment
Update an experiment by ID.
Path parameters
The Experiment ID of the Experiment you want to change
Query parameters
Action to change the state of the experiment. publish saves and stages your experiment. If you have not started your experiment or the experiment is paused, your changes will not be visible to visitors when you publish. start makes your experiment live to all visitors who are in your targeted audience and changes the status to running. pause stops the experiment and changes the status to paused. No new visitors will see a paused experiment until you restart it. See Differences among publish, start, and pause for details. resume resumes the experiment from a paused status without publishing any new changes. Status will be running. unarchive unarchives an archived experiment. Status will be paused.
Request body
Example request
{
"audience_conditions": "[\"and\", {\"audience_id\": 7000}, {\"audience_id\": 7001}]",
"changes": [
{
"dependencies": [
"993fd09c-b64a-4c13-95a9-13b3ed2c454e",
"95cf0144-fb63-431d-829b-193fe55ada18"
],
"name": "Setting button text",
"selector": "head",
"value": "window.someGlobalFunction();"
}
],
"description": "AB Test to see if the Blue Button converts more visitors",
"feature_id": 1000,
"holdback": 5000,
"key": "home_page_experiment",
"name": "Blue Button Experiment",
"schedule": {
"start_time": "2019-02-20T15:00",
"stop_time": "2019-02-20T18:00",
"time_zone": "America/New_York"
},
"traffic_allocation": 5000,
"url_targeting": {
"activation_code": "function callbackFn(activate, options) { activate(); }",
"activation_type": "callback",
"conditions": "[\"and\", {\"type\": \"url\", \"match_type\": \"substring\", \"value\": \"optimize\"}]",
"edit_url": "https://www.optimizely.com",
"key": "home_page",
"page_id": 6700
},
"variations": [
{
"actions": [
{
"changes": [
{
"allow_additional_redirect": true,
"async": true,
"attributes": {
"class": "new_class",
"style": "background-color:blue",
"text": "Some nice message"
},
"selector": "#my_div",
"type": "attribute"
}
],
"page_id": 5678
}
],
"variation_id": 1234,
"weight": 5000
}
],
"whitelist": [
{
"user_id": "user_1",
"variation_id": 12345
}
]
}Response
Successfully updated Experiment
Example response
{
"audience_conditions": "[\"and\", {\"audience_id\": 7000}, {\"audience_id\":7001}]",
"campaign_id": 2000,
"changes": [
{
"dependencies": [
"993fd09c-b64a-4c13-95a9-13b3ed2c454e",
"95cf0144-fb63-431d-829b-193fe55ada18"
],
"name": "Setting button text",
"selector": "head",
"value": "window.someGlobalFunction();"
}
],
"feature_id": 1000,
"feature_name": "This is the user search feature",
"holdback": 5000,
"id": 3000,
"key": "home_page_experiment",
"name": "Blue Button Experiment",
"project_id": 1000,
"schedule": {
"start_time": "2019-02-20T15:00",
"stop_time": "2019-02-20T18:00",
"time_zone": "America/New_York"
},
"traffic_allocation": 5000,
"url_targeting": {
"activation_code": "function callbackFn(activate, options) { activate(); }",
"activation_type": "callback",
"conditions": "[\"and\", {\"type\": \"url\", \"match_type\": \"substring\", \"value\": \"optimize\"}]",
"edit_url": "https://www.optimizely.com",
"key": "home_page",
"page_id": 6700
},
"variations": [
{
"actions": [
{
"changes": [
{
"attributes": {
"class": "intro",
"href": "example.com",
"html": "New Title",
"src": "song.mp3",
"style": "background-color:blue;",
"text": "Some nice message"
},
"dependencies": [
"ad1f6acb-78f2-4653-b955-913abd777e16",
"ad20a6dd-2083-4964-8ed2-f0dc7baef687"
],
"destination": "https://app.optimizely.com/",
"destination_function": "https://app.optimizely.com/",
"name": "Setting button text",
"operator": "after",
"selector": "a[href*=\"optimizely\"]",
"value": "window.someGlobalFunction();"
}
]
}
],
"key": "blue_button_variation",
"name": "Blue Button"
}
],
"whitelist": [
{
"user_id": "user_1",
"variation_id": 12345
}
]
}