POST /campaigns
Create a new Campaign in your account
Servers
- https://api.optimizely.com/v2
Request headers
| Name | Type | Required | Description |
|---|---|---|---|
Content-Type |
String | Yes |
The media type of the request body.
Default value: "application/json" |
Query parameters
| Name | Type | Required | Description |
|---|---|---|---|
action |
String | No |
Action to change the state of the Campaign. 'publish' publishes your campaign, making any changes live to the world. Status will be 'paused'. 'start' publishes your campaign, making any changes live to the world. Status will be 'running'. Valid values:
|
Request body fields
| Name | Type | Required | Description |
|---|---|---|---|
metrics[] |
Array | No |
An ordered list of metrics to track for the Campaign |
metrics[].aggregator |
String | No |
The aggregation function for the numerator of the metric. 'unique' measures the number of unique visitors/sessions that include the specified Event. 'count' measures the total number of occurrences of Event for the scope (visitor/session). 'sum' is the sum of the 'field' value Valid values:
|
metrics[].field |
String | No |
The field to aggregate for the numerator of the metric. Required when 'aggregator' = 'sum', otherwise omitted Valid values:
|
metrics[].winning_direction |
String | No |
The winning direction of this metric Valid values:
|
metrics[].event_id |
Integer | No |
The ID for the Event to select data from. Omitted for global metrics that are not relative to a specific Event, i.e. "overall revenue" |
metrics[].scope |
String | No |
Specifies how Events should be grouped together. Can also be thought of as the denonimator of the metric. 'session' divides by the number of sessions. "Influenced sessions", or sessions that do not contain a decision Event but carry a decision from a previous session are not included in counts for numerator or denominator. 'visitor' divides by the number of visitors. 'event' divides by the total occurrences (impressions) of the specified Event Valid values:
|
page_ids[] |
Array | No |
A list of Page IDs used in the Campaign |
project_id |
Integer | Yes |
The Project ID the Campaign is in |
description |
String | No |
The description or goal for a Campaign |
latest |
String | No |
The last time the Campaign was paused (not present if the Campaign still running) |
last_modified |
String | No |
The last time the Campaign was modified |
status |
String | No |
Current state of the Campaign. not_started means the Campaign has never been published to the world. running means the Campaign is currently live to the world. paused means the Campaign has been published, but is currently not running. archived means the Campaign is paused and not visible in the web UI. Valid values:
|
url_targeting |
Object | No | |
url_targeting.activation_type |
String | No |
How this page is activated. See the full documentation on the Page object. Valid values:
|
url_targeting.key |
String | No |
Unique string identifier for this Page within the Project |
url_targeting.activation_code |
String | No |
Stringified Javascript function that determines when the Page is activated. Only required when activation_type is 'polling' or 'callback'. |
url_targeting.conditions |
String | No |
Conditions to activate the experiment; our knowledge base article on Activation Types is the best guide for how to set up this data. |
url_targeting.page_id |
Integer | No |
The unique identifier of the Page that represents the experiment or campaign's URL Targeting. |
url_targeting.edit_url |
String | Yes |
URL to load in the editor for this page |
id |
Integer | No |
The unique identifier for the Campaign |
changes[] |
Array | No |
A list of changes to apply to the Campaign. This corresponds to the Campaign's Shared Code in the application. Only supports 'custom_css' or 'custom_code' type changes. |
changes[].id |
String | No |
The ID of the change |
changes[].selector |
String | No |
CSS selector to determine where changes are applied. Required for changes of type 'custom_css'. |
changes[].name |
String | No |
Name of the change |
changes[].dependencies[] |
Array | No |
A list of dependent change IDs that must happen before this change |
changes[].src |
String | No |
The path to the change payload on the CDN. Only present if 'async' is True. |
changes[].type |
String | Yes |
The type of this change. Valid values:
|
changes[].value |
String | Yes |
The value for the change can be JavaScript or CSS as a string. |
changes[].async |
Boolean | No |
Indicates whether or not to execute the change asyncronously. If true, src will be returned in the response. Otherwise, it will be not included. |
created |
String | No |
The time the Campaign was initially created |
holdback |
Integer | No |
Percentage of visitors to exclude from personalization, measured in basis points. 100 basis points = 1% traffic. For example, a value of 500 would mean that 95% of visitors will see a personalized experience and 5% will see the holdback. |
name |
String | No |
The name of the Campaign |
earliest |
String | No |
The first time the Campaign was activated |
experiment_priorities[] |
Array | No |
A list of lists of Experiment IDs that indicate the relative priority of how to show those Experiments in the context of the Campaign. Each list inside of the list represents a group of Experiments of equal priority where groups that appear earlier in the list are of higher priority to be shown. |
type |
String | No |
Indicates the type of this campaign. Campaigns created or fetched via the API should currently all have a type of Valid values:
Default value: "personalization" |
How to start integrating
- Add HTTP Task to your workflow definition.
- Search for the API you want to integrate with and click on the name.
- This loads the API reference documentation and prepares the Http request settings.
- Click Test request to test run your request to the API and see the API's response.