List A/B tests
const url = 'https://api.getsitecontrol.com/v1/sites/1/widgets/ab-tests';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.getsitecontrol.com/v1/sites/1/widgets/ab-tests \ --header 'Authorization: Bearer <token>'Every A/B test of the site with its widgets and their results, as on the admin’s A/B tests page. For each widget: views (times shown), actions (forms sent and buttons used) and ctr = actions / views, counted from added_at; leader_id is the widget ahead. findings are facts about the test setup: tell the user each one with what to do. A site runs up to five tests, named 1 to 5; visitors are split evenly between the widgets of a test that are on, and each visitor keeps the same widget on every visit. A widget’s statistics over any period are in Widget statistics. How to read and run a test: the guide widgets.activity.read, topic ab_tests.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Responses
Section titled “Responses”object
Every test of the site that has a widget, by name; at most five
object
The admin’s slot, shown there as Test 1 … Test 5
The widget ahead: the highest CTR, ties to the first listed; the one Stop keeps unless told otherwise
In the admin’s order; at least one. Visitors are split evenly between the widgets that are on
object
An off widget stays in the test but is not shown; a test shows its widgets that are on
Results counted from: when the widget joined the test or the results were last reset
Counts by event type since added_at: show (views) and every action the widget has now — submit (forms sent), openUrl, showWidget, addToCart, applyCoupon, copyToClipboard (button clicks); only the keys the widget has
object
Times the widget was shown since added_at; total.show. The admin’s Views
Forms sent and buttons used since added_at: every key of total but show, summed. The admin’s Actions
actions / views as a fraction, the admin’s CTR rounded half up to 4 places (0.0325 is 3.25%); 0 while there are no views
Facts the server worked out about the test: targeting that differs between the widgets, one widget on, on/off switches since added_at, a widget without views; empty when there is nothing to say
object
Targeting_differs: the widgets differ in the targeting block named in detail; single_widget_on: only one widget of the test is on, every visitor gets it; switched: the widget was turned off or on after its results started counting; no_switch_history: the widget’s results count from before on/off history was kept, so switches before that are unknown; no_views: the widget has no views since added_at, detail says what its settings show.
The widgets the finding is about
One short sentence with the facts, in the user’s terms; wording is not stable, do not parse
{ "items": [ { "findings": [ { "kind": "targeting_differs" } ] } ]}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
Authentication scheme: Bearer
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds
Seconds until the bucket refills
The documented shape of every error body on the versioned surface.
object
object
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example", "reason": "example", "next": "example", "request_id": "example", "errors": [ { "loc": [ "example" ], "msg": "example", "type": "example" } ], "metadata": {}}Headers
Section titled “Headers”API version the response was produced for
Request id, echoed from the request when valid
Limit of the tightest bucket
Requests left in its window
End of its window, epoch seconds