A/B tests data reporting
Create and update A/B tests
You create and update A/B tests using the POST /v3/data-centers/{apiKey}/ab-tests and PUT /v3/data-centers/{apiKey}/ab-tests/{ab-test-id} requests respectively. Note that when creating the A/B test, you need to provide the required properties. For more information, see A/B test API data types.
You can have only one A/B test per DefinitionPageId and DefinitionPageLanguage combination.
When creating or updating an A/B test, you must ensure the following:
- The
PrimaryGoalId/OriginalVariantIdproperty values correspond to one of the goals/variants reported in theGoals/Variantsproperties - The
StartDateandStopDateare not in the past
During update, if you are changing the BusinessState, make sure the transition you are making is not forbidden - for example, from NotStarted to Ended. For a full list of forbidden business state transitions, see Business state transitions.
Also, if you change the start date of the A/B test, all of the statistics between the old and the new start date will be deleted.
Report A/B test variant visit
To report a variant visit of an A/B test, you post an interaction with a Visit predicate and the proper object metadata. The object needs to have the A/B test object metadata API data type, along with the object metadata properties Id, PageId, and Language (only when the A/B test DefinitionPageLanguage property is not null).
For example, you wish to report to Sitefinity Insight that a contact with subject "john.smith@test.com" visited a variant with ID "33c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5" of an A/B test with the following details:
"Id": "4d0f8cff-ed02-463b-a34a-f34579e52a50""DefinitionPageId": "3d0f8cff-ed02-463b-a34a-f34579e52a50""DefinitionPageLanguage": "en"
To do this, you report an interaction using the POST /collect/v2/data-centers/{data-source-name}/datasources/{data-source-name}/interactions endpoint with the following body:
{
"S": "john.smith@test.com",
"P": "Visit",
"OM": {
"Id": "3d0f8cff-ed02-463b-a34a-f34579e52a50",
"PageId": "3d0f8cff-ed02-463b-a34a-f34579e52a50",
"Language": "en",
"ABTest": {
"Id": "4d0f8cff-ed02-463b-a34a-f34579e52a50",
"VariantId": "33c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5"
}
}
}
Note that you can report any other object metadata within the same call, for example, page title, author, and so on. The variant visit is recognized as long as you have the object metadata properties in the body used above.
Report completion of an A/B test goal
Sitefinity Insight currently supports two types of A/B test goals - local and global. The global goal is tied to a conversion tracking defined in Sitefinity Insight and you do not need to send any special interaction to report its completion. If a contact converts any time after seeing a variant of the A/B tested page, Sitefinity Insight automatically registers a hit in the global goal of the A/B test.
Local A/B test goals can be defined with any predicate, object, and object metadata. Reporting a completion of a local A/B test goal is simply posting an interaction with the predicate, object, and object metadata of the goal. For example, you wish to report a completion of the following A/B test goal:
{
"Id": "18f40e40-ba2d-42d7-be91-b29c5296d22d",
"Name": "Next page viewed is AB Test Next Page Goal",
"Definition": {
"Relation": "1",
"Parts": [
{
"Id": 1,
"Predicate": "Visit",
"IsNegated": false,
"PredicateOperator": "ExactMatch",
"ObjectOperator": "ExactMatch",
"Objects": [
"contactUs"
],
"ObjectMetadata": {
"PreviousPageTitle": "Home",
"ClientLocation": "Europe"
}
}
]
},
"GoalType": "Local"
}
To report that “john.smith@test.com” has completed that local goal, simply send an interaction using the POST /collect/v2/data-centers/{data-source-name}/datasources/{data-source-name}/interactions endpoint with the following body:
{
"S": "john.smith@test.com",
"P": "Visit",
"O": "contactUs",
"OM": {
"PreviousPageTitle": "Home",
"ClientLocation": "Europe"
}
}
Business state transitions
The following tables summarize the actions performed during business state transitions.
| Not Started | Scheduled | Active | Stopped | Ended | |
| Not started | N/A | ⚫️ Update | ⚫️ Update | - | X |
| Scheduled | ⚫️ Update | N/A | ⚫️ Update | - | X |
| Active | X | 🔴 Restart | N/A | ⚫️ Update + Stop | 🔵 End |
| Stopped | X | 🔴 Restart | ⚫️ Update | N/A | 🔵 End |
| Ended | X | X | X | X | N/A |
In the table above:
- N/A
Not applicable. - -
Do nothing. Only State update. - X
Forbidden transition.
The following table summarizes the business state transition actions.
| Action | Description |
| Initialize | New variants/goals will be initialized. |
| Stop | Next nightly statistics calculation will produce a statistics record where IsPaused will be set to 1.Statistics will not be calculated any further until the A/B test is started again. |
| 🔴 Restart |
|
| ⚫️ Update |
|
| 🔵 End |
|
| Delete | Remove all related A/B test data |
Browse Sitefinity Insight A/B testing API
You can browse the full Sitefinity Insight A/B testing API using the dedicated API browser.