A/B tests endpoints

GET /analytics/v1/ab-tests

URL https://api.insight.sitefinity.com/analytics/v1/ab-tests

Sample request and response

The following request:

  • Filters only A/B tests, which are active
  • Sorts by ascending name
  • Skips the first one and take the next two
  • Returns the total number of A/B tests in the data center

HTTP:

Headers:

  • Authorization: bearer token
  • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9
  • x-dataintelligence-skip: 1
  • x-dataintelligence-take: 2
  • x-dataintelligence-filter: {“BusinessStatus”: “Active”}
  • x-dataintelligence-sort: {“Name”: 1}
  • x-dataintelligence-count: true

GET /analytics/v1/ab-tests/{ab-test-id}

Resource information

URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/{ab-test-id}

Sample request and response

HTTP:

GET https://api.insight.sitefinity.com/analytics/v1/ab-tests/1D0F8CFF-ED02-463B-A34A-F34579E52A50

Headers:

  • Authorization: bearer token
  • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

JSON sample response:

{
"Id": "1D0F8CFF-ED02-463B-A34A-F34579E52A50",
"Name": "Documentation AB Test Home Page",
"StartDate": "2018-02-21T13:00:00.000Z",
"StopDate": "2018-02-22T22:00:00.000Z",
"StatisticsCalculatedOn": null,
"DefinitionPageId": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
"DefinitionPageLanguage": null,
"State": 2,
"BusinessStatus": "Active",
"PrimaryGoalId": "18F40E40-BA2D-42D7-BE91-B29C5296D22D",
"OriginalVariantId": "13C7E1F9-8BF8-4B3C-B2EA-81F9AE4053E5",
"UniqueVisits": 0,
"ActiveDays": 0,
"Variants": [
{
"Id": "13C7E1F9-8BF8-4B3C-B2EA-81F9AE4053E5",
"Name": "Original",
"Percentage": 50,
"State": 1,
"UniqueHitsCount": null
},
{
"Id": "188C9DFE-3488-4BDB-8034-A804CD8AA4A4",
"Name": "Modified",
"Percentage": 50,
"State": 1,
"UniqueHitsCount": null
}
],
"Goals": [
{
"Id": "1D05C4A4-BAE5-4392-B009-1E6EE9D65D44",
"Name": "Purchase Conversion AB Goal",
"ConversionId": 1,
"GoalType": "Global",
"State": 1,
"WinnerVariantId": null
},
{
"Id": "18F40E40-BA2D-42D7-BE91-B29C5296D22D",
"Name": "Next page viewed is Contact Us Page Goal",
"ConversionId": null,
"GoalType": "Local",
"State": 1,
"Definition": {
"Relation": "1",
"Parts": [
{
"Id": 1,
"Predicate": "Visit",
"IsNegated": false,
"PredicateOperator": "ExactMatch",
"ObjectOperator": "ExactMatch",
"Objects": [
"contact-us"
],
"ObjectMetadata": {
"PreviousPageId": "1d0f8cff-ed02-463b-a34a-f34579e52a50"
}
}
]
},
"WinnerVariantId": null
}
],
"CanonicalUrl": null
}

GET /analytics/v1/ab-tests/{ab-test-id}/goals/{ab-test-goal-id}/statistics

Sample request and response

HTTP:

GET https://api.insight.sitefinity.com/analytics/v1/ab-tests/4D0F8CFF-ED02-463B-A34A-F34579E52A50/goals/78F40E40-BA2D-42D7-BE91-B29C5296D22D/statistics

Headers:

  • Authorization: bearer token
  • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9
  • x-dataintelligence-filter: {"CreatedOn": "2018-02-06T00:01:00.000Z"}

GET /analytics/v1/ab-tests/dec-conversions

Resource information

URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/dec-conversions
HTTP method GET
Description Obtain the A/B test-compatible Sitefinity Insight conversion reports, which can be used as global A/B test goals.
Authentication Required

Parameters

Name Location Required Data type Description
Authorization Header Yes String The access token of the user.
x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.

Responses

Name Returned data Description
200 OK {
"items": Array
}

Returns a collection of objects, containing the name and ID of the Sitefinity Insight-compatible goals, for example:

{

"items": [

{

"Id": 1,

"Name": "Purchase Product"

},

{

"Id": 52,

"Name": "Watch Webinar"

},

{

"Id": 53,

"Name": "Submit Contact Us Form"

}

]

}

401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.

Sample request and response

    HTTP:

    GET https://api.insight.sitefinity.com/analytics/v1/ab-tests/dec-conversions

    Headers:

    • Authorization: bearer token
    • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

    JSON sample response:

    {
    "items": [
    {
    "Id": 1,
    "Name": "Purchase Product"
    },
    {
    "Id": 52,
    "Name": "Watch Webinar"
    },
    {
    "Id": 53,
    "Name": "Submit Contact Us Form"
    }
    ]
    }
    view raw gistfile1.txt hosted with ❤ by GitHub

    POST /analytics/v1/ab-tests

    Resource information

    URL https://api.insight.sitefinity.com/analytics/v1/ab-tests
    HTTP method POST
    Description Create A/B test.
    Authentication Required

    Parameters

    Name Location Required Data type Description
    Authorization Header Yes String The access token of the user.
    x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.

    Request body

    Name Required Data type Description
    JSON root Yes AbTest The A/B test you want to create.

    Responses

    Name Returned data Description
    200 OK

    AbTest

    The created A/B test.

    400 Bad Request GeneralErrorResponse Returned when the provided A/B test id is not a valid Guid or when you have provided an empty Variants property.
    401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
    403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
    412 Precondition failed GeneralErrorResponse Returned when you provided an empty JSON.

    Sample request and response

      HTTP:

      POST https://api.insight.sitefinity.com/analytics/v1/ab-tests

      Headers:

      • Authorization: bearer token
      • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

      Body JSON:

      {
      "Id": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
      "Name": "Documentation AB Test Home Page",
      "DefinitionPageId": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
      "BusinessStatus": "Active",
      "StartDate": "2018-02-21T13:00:00.000Z",
      "StopDate": "2018-02-22T22:00:00.000Z",
      "PrimaryGoalId": "18f40e40-ba2d-42d7-be91-b29c5296d22d",
      "OriginalVariantId": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Variants": [
      {
      "Id": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Name": "Original",
      "Percentage": 50
      },
      {
      "Id": "188c9dfe-3488-4bdb-8034-a804cd8aa4a4",
      "Name": "Modified",
      "Percentage": 50
      }
      ],
      "Goals": [
      {
      "Id": "1d05c4a4-bae5-4392-b009-1e6ee9d65d44",
      "Name": "Insight conversion is AB Test Goal",
      "GoalType": "Global",
      "ConversionId": 1
      },
      {
      "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": [
      "contact-us"
      ],
      "ObjectMetadata": {
      "PreviousPageTitle": "Home",
      "ClientLocation": "Europe"
      }
      }
      ]
      },
      "GoalType": "Local"
      }
      ]
      }

      JSON sample response:

      {
      "Id": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
      "Name": "Documentation AB Test Home Page",
      "DefinitionPageId": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
      "BusinessStatus": "Active",
      "StartDate": "2018-02-21T13:00:00.000Z",
      "StopDate": "2018-02-22T22:00:00.000Z",
      "PrimaryGoalId": "18f40e40-ba2d-42d7-be91-b29c5296d22d",
      "OriginalVariantId": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Variants": [
      {
      "Id": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Name": "Original",
      "Percentage": 50
      },
      {
      "Id": "188c9dfe-3488-4bdb-8034-a804cd8aa4a4",
      "Name": "Modified",
      "Percentage": 50
      }
      ],
      "Goals": [
      {
      "Id": "1d05c4a4-bae5-4392-b009-1e6ee9d65d44",
      "Name": "Insight conversion is AB Test Goal",
      "GoalType": "Global",
      "ConversionId": 1
      },
      {
      "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": [
      "contact-us"
      ],
      "ObjectMetadata": {
      "PreviousPageTitle": "Home",
      "ClientLocation": "Europe"
      }
      }
      ]
      },
      "GoalType": "Local"
      }
      ]
      }

      PUT /analytics/v1/ab-tests/{ab-test-id}

      Resource information

      URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/{ab-test-id}
      HTTP method PUT
      Description Updates an A/B test
      Authentication Required

      Parameters

      Name Location Required Data type Description
      Authorization Header Yes String The access token of the user.
      x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.
      ab-test-id URI path Yes Guid The ID of the A/B test you want to update.

      Request body

      Name Required Data type Description
      JSON root Yes AbTest The properties of the A/B test you wish to update. Note that you do not need to provide all of the properties (even the ones that are required upon creation). For example, you do not need to provide the id of the A/B Test here.

      Responses

      Name Returned data Description
      200 OK

      AbTest

      The updated A/B test.
      400 Bad Request GeneralErrorResponse Returned when the provided A/B test ID is not a valid GUID or when you have provided an empty Variants property.
      401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
      403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
      412 Precondition Failed GeneralErrorResponse Returned when you provided an empty JSON.

      Sample request and response

      HTTP:

      PUT https://api.insight.sitefinity.com/analytics/v1/ab-tests/1d0f8cff-ed02-463b-a34a-f34579e52a50

      Headers:

      • Authorization: bearer token
      • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

      Body JSON:

      {
      "Name": "Documentation AB Test Home Page",
      "DefinitionPageId": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
      "BusinessStatus": "Active",
      "StartDate": "2018-02-21T13:00:00.000Z",
      "StopDate": "2018-02-22T22:00:00.000Z",
      "PrimaryGoalId": "18f40e40-ba2d-42d7-be91-b29c5296d22d",
      "OriginalVariantId": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Variants": [
      {
      "Id": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Name": "Original",
      "Percentage": 50
      },
      {
      "Id": "188c9dfe-3488-4bdb-8034-a804cd8aa4a4",
      "Name": "Modified",
      "Percentage": 50
      }
      ],
      "Goals": [
      {
      "Id": "1d05c4a4-bae5-4392-b009-1e6ee9d65d44",
      "Name": "Insight conversion is AB Test Goal",
      "GoalType": "Global",
      "ConversionId": 1
      },
      {
      "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": [
      "contact-us"
      ],
      "ObjectMetadata": {
      "PreviousPageTitle": "Home",
      "ClientLocation": "Europe"
      }
      }
      ]
      },
      "GoalType": "Local"
      }
      ]
      }

      JSON sample response:

      {
      "Id": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
      "Name": "Documentation AB Test Home Page",
      "DefinitionPageId": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
      "BusinessStatus": "Active",
      "StartDate": "2018-02-21T13:00:00.000Z",
      "StopDate": "2018-02-22T22:00:00.000Z",
      "PrimaryGoalId": "18f40e40-ba2d-42d7-be91-b29c5296d22d",
      "OriginalVariantId": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Variants": [
      {
      "Id": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Name": "Original",
      "Percentage": 50
      },
      {
      "Id": "188c9dfe-3488-4bdb-8034-a804cd8aa4a4",
      "Name": "Modified",
      "Percentage": 50
      }
      ],
      "Goals": [
      {
      "Id": "1d05c4a4-bae5-4392-b009-1e6ee9d65d44",
      "Name": "Insight conversion is AB Test Goal",
      "GoalType": "Global",
      "ConversionId": 1
      },
      {
      "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": [
      "contact-us"
      ],
      "ObjectMetadata": {
      "PreviousPageTitle": "Home",
      "ClientLocation": "Europe"
      }
      }
      ]
      },
      "GoalType": "Local"
      }
      ]
      }

      PUT/analytics/v1/ab-tests/{ab-test-id}/status

      Resource information

      URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/{ab-test-id}/status
      HTTP method PUT
      Description Updates the status if the A/B test
      Authentication Required

      Parameters

      Name Location Required Data type Description
      Authorization Header Yes String The access token of the user.
      x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.
      ab-test-id URI path Yes Guid The ID of the A/B test you want to update the status of.

      Request body

      Name Required Data type
      JSON root Yes AbTestStatusUpdate

      Responses

      Name Returned data Description
      200 OK AbTest The updated A/B test.
      400 Bad Request GeneralErrorResponse Returned when the provided A/B test ID is not a valid GUID or when you have provided an empty Variants property.
      401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
      403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
      412 Precondition Failed GeneralErrorResponse Returned when you provided an empty JSON.

      Sample request and response

      HTTP:

      PUT https://api.insight.sitefinity.com/analytics/v1/ab-tests/1d0f8cff-ed02-463b-a34a-f34579e52a50/status

      Headers:

      • Authorization: bearer token
      • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

      Body JSON:

      {
      "BusinessStatus": "Active",
      "StartDate": "2018-02-21T13:00:00.000Z",
      "StopDate": "2018-02-22T22:00:00.000Z"
      }

      JSON sample response:

      {
      "Id": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
      "Name": "Documentation AB Test Home Page",
      "DefinitionPageId": "1d0f8cff-ed02-463b-a34a-f34579e52a50",
      "BusinessStatus": "Active",
      "StartDate": "2018-02-21T13:00:00.000Z",
      "StopDate": "2018-02-22T22:00:00.000Z",
      "PrimaryGoalId": "18f40e40-ba2d-42d7-be91-b29c5296d22d",
      "OriginalVariantId": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Variants": [
      {
      "Id": "13c7e1f9-8bf8-4b3c-b2ea-81f9ae4053e5",
      "Name": "Original",
      "Percentage": 50
      },
      {
      "Id": "188c9dfe-3488-4bdb-8034-a804cd8aa4a4",
      "Name": "Modified",
      "Percentage": 50
      }
      ],
      "Goals": [
      {
      "Id": "1d05c4a4-bae5-4392-b009-1e6ee9d65d44",
      "Name": "Insight conversion is AB Test Goal",
      "GoalType": "Global",
      "ConversionId": 1
      },
      {
      "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": [
      "contact-us"
      ],
      "ObjectMetadata": {
      "PreviousPageTitle": "Home",
      "ClientLocation": "Europe"
      }
      }
      ]
      },
      "GoalType": "Local"
      }
      ]
      }

      DELETE /analytics/v1/ab-tests/{ab-test-id}

      Resource information

      URL https://api.insight.sitefinity.com/analytics/v1/ab-tests/{ab-test-id}
      HTTP method DELETE
      Description Delete and A/B test by ID
      Authentication Required

      Parameters

      Name Location Required Data type Description
      ab-test-id URI path Yes Guid The ID of the A/B test you want to delete.
      Authorization Header Yes String The access token of the user.
      x-dataintelligence-datacenterkey Header Yes Guid The API key of the data center.

      Responses

      Name Returned data Description
      200 OK Empty JSON
      400 Bad Request GeneralErrorResponse Returned when the provided ab-test-id is not a valid GUID.
      401 Unauthorized Unauthorized Returned when an invalid or expired token has been provided in the Authorization header.
      403 Forbidden GeneralErrorResponse Returned when an invalid API key is provided in the x-dataintelligence-datacenterkey parameter or when a valid key is provided but one to which the authenticated user does not have access to.
      404 Not Found GeneralErrorResponse Returned when the provided GUID in the ab-test-id parameter does not match the ID of any of the A/B tests in the provided data center.

      Sample request and response

      HTTP:

      DELETE https://api.insight.sitefinity.com/analytics/v1/ab-tests/1D0F8CFF-ED02-463B-A34A-F34579E52A50

      Headers:

      • Authorization: bearer token
      • x-dataintelligence-datacenterkey: c27aeeb7-d222-d848-d8bf-9792485dafa9

      JSON sample response:

      {}

      Was this article helpful?