Skip to content

End an experiment

POST
/api/v1/analytics/experiments/{id}/end
curl --request POST \
--url https://digize.com/api/v1/analytics/experiments/example/end \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: 5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69' \
--header 'x-api-key: <x-api-key>' \
--data '{ "winner": "a", "serve": true, "note": "example" }'

Ends an experiment for good, naming the winner if there is one. With serve, a winner other than the control is shown to every visitor from then on, until the change is in the site’s own code (then turn it off with analytics.experiments.serve); without it, everyone sees the site as it is. Its results stay.

Needs the analytics:write permission.

id
required

The experiment’s id, from analytics.experiments.list.

string
/^exp_[0-9A-HJKMNP-TV-Z]{26}$/
Idempotency-Key
string
>= 1 characters <= 255 characters

Makes the request safe to send again: for 24 hours the same key and request answer the first response without repeating the change.

Example

5f1c2a8e-3b7d-4c55-9a0e-1f2d3c4b5a69
Media typeapplication/json
object
winner
Any of:
string
Allowed values: a b c d
serve

Show the winner to every visitor until the site’s code has it.

boolean
note

Why it ended, in a sentence.

string
<= 500 characters

Done

Media typeapplication/json
object
id
required
string
siteId
required
string
siteName
required
string | null
hostname
required

The site’s address, its own domain first.

string | null
name
required
string
hypothesis
required
string
kind
required
string
Allowed values: content page site
pages
required
Array<string>
traffic
required
number
variants
required
Array<object>
object
key
required
string
Allowed values: a b c d
name
required
string
weight
required
number
swaps
required
Array<object>
object
selector
required
string
op
required
string
Allowed values: text html replace attribute remove
attribute
string
value
string
css
required
string
path
required
string | null
siteId
required
string | null
siteName
required
string | null
addedAt
required
Any of:
string format: date-time
previewUrl
required

Opens this variant of the first page for whoever follows it, counting nothing.

string | null
goal
required
object
kind
required
string
Allowed values: lead booking checkout purchase page event scroll
match
required
string
status
required
string
Allowed values: draft running paused ended
winner
required
Any of:
string
Allowed values: a b c d
serving
required

Ended with its winner shown to every visitor, until the change is in the site’s code.

boolean
note
required
string
startedAt
required
Any of:
string format: date-time
endedAt
required
Any of:
string format: date-time
createdBy
required
string
createdAt
required
string format: date-time
updatedAt
required
string format: date-time

Example

{
"kind": "content",
"variants": [
{
"key": "a",
"swaps": [
{
"op": "text"
}
]
}
],
"goal": {
"kind": "lead"
},
"status": "draft",
"winner": "a"
}

What was sent isn’t valid (invalid).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

No key, or one that’s unknown, off or expired.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The key doesn’t have the permission this needs.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Nothing has that id (not_found).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

A request with the same Idempotency-Key is still running (conflict).

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

The Idempotency-Key was used with a different request.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}

Over the rate limit; see retry-after.

Media typeapplication/json
object
error
required
object
code
required
string
Allowed values: invalid unauthorized forbidden not_found conflict too_large rate_limited unavailable internal
message
required
string
details
object
key
additional properties
any

Example

{
"error": {
"code": "invalid"
}
}