v4
latestOpenAPI 3.0.02026-08-04109113304.5 KBExperiments
Create an Experiment
Create an Experiment in a Project
post/experiments
Query parameters
action'publish' | 'start' | 'pause'
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.
Request body
Example request
{
"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
}
]
}Response
Return the created 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
}
]
}