Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Response examples

Shows response examples.

The following example shows three recommendations returned for one widget with full product details. This is the default behavior when recContent is omitted or has a value of full.

{
      "status"	       : "OK",
      "pageTrackingId" : "523863900/4ubJYHs6gwcwUz9xCjCmng",
      "session"	       : {
        "session" : "123456789012|a1b2c3d4e5A6B7C8D9E0f1g2h3i4j5F1G2H3I4J5k1l",
        "cuid"    : "09876543210|Z0Y9X8W7V6z5y4x3w2v1U0T9S8R7Q6u5t4s3r2q1P0O"
      },
      "info"	         : {
        "smartRecs" : [
          { "click" : "ok",
            "id"    : 1353835050
          }
        ]
      },
      "smartRecs"	   : [
        { "widget"   : "homejson",
          "alias"    : "homewidget",
          "position" : "homebottom",
          "recs"     : [
            { "img"     : "http://www.retailer.com/img/RC678_size_small",
              "title"   : "Levis Washed Jeans",
              "url"     : "http://www.retailer.com/product/RC678.html",
              "refCode" : "RC678",
              "prices"  : {
                "GBP" : { "unitPrice" : 52.00,
                          "salePrice" : 40.00
                        }
              },
              "id"      : 32720906612
            },
            { "img"     : "http://www.retailer.com/img/RC910_size_small",
              "title"   : "Levis Dirty Jeans",
              "url"     : "http://www.retailer.com/product/RC910.html",
              "refCode" : "RC910",
              "prices"  : {
                "GBP" : { "unitPrice" : 54.95,
                          "salePrice" : 43.95
                        }
              },
              "id"      : 32720906613
            },
            {	"img"     : "http://www.retailer.com/img/RC101_size_small",
              "title"   : "Levis Legless Jeans",
              "url"     : "http://www.retailer.com/product/RC101.html",
              "refCode" : "RC101",
              "prices"  : {
                "GBP" : { "unitPrice" : 39.95,
                          "salePrice" : 39.95
                        }
              },
              "id"      : 32720906614
            }
          ]
        }
      ]
    }

The following shows the returned result if the recContent property is set to refCodeOnly.

{
      "status"	       : "OK",
      "pageTrackingId" : "523863900/4ubJYHs6gwcwUz9xCjCmng",
      "session"	       : {
        "session" : "123456789012|a1b2c3d4e5A6B7C8D9E0f1g2h3i4j5F1G2H3I4J5k1l",
        "cuid"    : "09876543210|Z0Y9X8W7V6z5y4x3w2v1U0T9S8R7Q6u5t4s3r2q1P0O"
      },
      "smartRecs"	     : [
        {
          "widget"   : "homejson",
          "alias"    : "homewidget",
          "position" : "homebottom",
          "recs"     : [
            {
              "refCode" : "RC678",
              "id"      : 32720906612
            },
            {
              "refCode" : "RC910",
              "id"      : 32720906613
            },
            {
              "refCode" : "RC101",
              "id"      : 32720906614
            }
          ]
        }
      ]
    }

The following example shows the returned result if the recContent property is set to refCodeOnly and the attribute colour is included in the request. (See Recommendations configuration.

{
    ...
    "smartRecs": [
      {
        "widget"   : "homejson",
        "alias"    : "homewidget",
        "position" : "homebottom",
        "recs"     : [
          {
            "refCode"    : "RC678",
            "id"         : 32720906612,
            "attributes" : {"colour" : "dirty blue"}
          },
          {
            "refCode"    : "RC910",
            "id"         : 32720906613,
            "attributes" : {"colour" : "washed blue"}
          },
          {
            "refCode"    : "RC101",
            "id"         : 32720906614,
            "attributes" : {"colour" : "just blue"}
          }
        ]
      }
    ]
  }

If the user clicks a Recommendations item, the click is tracked (see Click tracking.