HomeGuidesAPI Reference
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

A/B testing

To run A/B tests that test your current setup or existing recommendations against Optimizely recommendations, request additional A/B test information by adding the abTestContent property.

NameDescription and usage
abTestContent[Optional] [String]

Activate A/B test output.
- summary – Returns only A/B test name and the page visitor's group.
- full – Returns all available information.

If you specify the property name with an empty string, summary is used by default.

To request full A/B test information, set the abTestContent attribute in the tracking request to full, as shown below.

{    
      "type"          : "home",
      "ip"            : "10.42.37.139",
      "session"       : "new",
      "cuid"          : "new",
      "site"          : "retailer",
      "clientToken"   : "1234abcd5678",
      "channel"       : "web",
      "lang"          : "en-gb",
      "currentURI"    : "www.retailer.com/home",
      "previousURI"   : "https://www.google.co.uk/?gws_rd=ssl#q=retailer",   
      "userAgent"     : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
      "abTestContent" : "full"
    }

This results in the following info section being returned in the response.

Name Descriptions and usage
abtest An array of A/B test product records.
  <productname> The product name where <productname> is one of:
  • smartRecs
  • smartContent
    name [String]

A/B test name.
    group [String]

The group assigned to the current visitor.
    configs A list of all Optimizely A/B test configurations that deliver Optimizely recommendations.

Note: If the current A/B group does not appear in this list, no Optimizely recommendations are configured to be served for the current visitor.
      <group> An array of configurations to be shown for this test group, where <group> is the test group letter, such as “A” or “B”.
        name [String]

Item name.

The name of the widget, creative, or listing that is shown if the test group letter matches the group assigned to the current visitor.
        position [String]

The position of the item.

Describes the page position where the item is shown.

A/B testing example 1

{
      "status"         : "OK",
      "pageTrackingId" : "523863900/4ubJYHs6gwcwUz9xCjCmng",
      "session"        : {
                           "session" : "123456789012|a1b2c3d4e5A6B7C8D9E0f1g2h3i4j5F1G2H3I4J5k1l",
                           "cuid"    : "09876543210|Z0Y9X8W7V6z5y4x3w2v1U0T9S8R7Q6u5t4s3r2q1P0O"
                         },
      "info"           : {
         "abtest" : [{
           "smartRecs" : [{
             "name"    : "a/b test",
             "group"   : "A",
             "configs" : {
                           "A": [{
                                   "name"     : "homeA",
                                   "position" : "homejson"
                                }],
                           "B": [{
                                   "name"     : "homeB",
                                   "position" : "homejson"
                                }]
                         }
           }]
         }]
      }
    }

To request only the name of the A/B test and the group of the page visitor, set the the tracking request's abTestContent attribute to summary.

{      
      "type"          : "home",
      "ip"            : "10.42.37.139",
      "session"       : "new",
      "cuid"          : "new"
      "site"          : "retailer",
      "clientToken"   : "1234abcd5678",
      "channel"       : "web",
      "lang"          : "en-gb",
      "currentURI"    : "www.retailer.com/home",
      "previousURI"   : "https://www.google.co.uk/?gws_rd=ssl#q=retailer",
      "userAgent"     : "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36",
      "abTestContent" : "summary"
    }

The resulting response includes this info section.

NameDescription and usage
abtestAn array of A/B test product records.
 The product name where is smartRecs or smartContent.
  name[String]
A/B test name.
  group[String]
The group assigned to the current visitor.

A/B testing example 2

{
      "status"         : "OK",
      "pageTrackingId" : "523863900/4ubJYHs6gwcwUz9xCjCmng",
      "session"        : {
                           "session" : "123456789012|a1b2c3d4e5A6B7C8D9E0f1g2h3i4j5F1G2H3I4J5k1l",
                           "cuid"    : "09876543210|Z0Y9X8W7V6z5y4x3w2v1U0T9S8R7Q6u5t4s3r2q1P0O"
                         },
      "info"           : {
        "abtest"  : [{
          "smartRecs" : [{
                           "name"  : "a/b test",
                           "group" : "A"
                        }]
                     }]
      }
    }

📘

Note

Each product can have different A/B groups. So, do not assume that a visitor in group A for recommendations is also in group A for another Optimizely product, such as, Optimizely Promote.


What’s Next