A/B tests data reporting

Create and update A/B tests

You create and update A/B tests using the POST /analytics/v1/ab-tests and PUT /analytics/v1/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 type.

You can have only one A/B test per DefinitionPageId and DefinitionPageLanguage combination.

When creating/updating you must ensure the following:

  • The PrimaryGoalId/OriginalVariantId property values correspond to one of the goals/variants reported in the Goals/Variants properties
  • The StartDate and StopDate are 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 object, along with the object metadata properties Id, PageId, and Language (only if the A/B test’s 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:


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. For details, see A/B test goal API data type.

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:

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
  • New variants/goals added and initialized
  • ToBeDeleted variants/goals will be removed along with all their artifacts, including statistics
  • A/B test is restarted - ActiveDays and UniqueVisits are set to 0
⚫️ Update
  • New variants/goals added and initialized
  • ToBeDeleted variants/goals will be removed along with all their artifacts, including statistics
🔵 End
  • Statistics will be calculated for one last time, with timestamp for tomorrow
  • AB test, its goal(s) and variant(s) will be set to Inactive
  • Statistics will not be calculated any further
Delete Remove all related A/B test data

Was this article helpful?