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 message

Shows response messages.

The response message has the following properties:

Name Description and usage
status The status of the request as one of the following:
  • OK. A successful request.
  • fail. An error occurred.
  • warning. Errors were found but a useful result was still returned.
Note: If a fail status is returned, a fatal error occurred, and the request could not be fulfilled and recommendations are not included in the response.
pageTrackingId Unique identifier of the tracking page.

For use with Personalized Search & Navigation only.

Used to track any future information or user event on this page. For example, a selected facet on a Search Results page.
Note: Available from version 1.3 of the Server-to-Server API.
errors Shown if status is fail or warning.
  code The type of error. See Error codes.
  message Explanation with debug information that may contain advice about how to solve the error.
session Shown if status is OK.
  session Allocated ID of Optimizely session established with the tracker.
  cuid Consolidated value of the user ID.
info Click information.

Displayed only if click information was provided in the request. An array of the Optimizely products given in the request. Available values are smartRecs and smartContent.
  smartRecs An array of click information for Optimizely Product Recommendations.
    click [String]

Confirmation that the click was successful.
    id [64-bit number]

The ID of the Optimizely product recommendation. For example, "id": 5637282.

Failure response

If status is fail or warning, an errors element is returned after the status property. The value is a list of errors or warnings encountered. Failure response example.

{
      "status" : "fail",
      "errors" : [
        {  
          "code"    : "MalformedJson",
          "message" : "Json Parsing exception: Malformed JSON. Unexpected character ('{' (code 123)): was expecting double-quote to start field name at character offset 1."
        }
      ]
    }

Successful response

If the status is not fail, the session element is returned containing the current cuid session and pageTrackingId. These are string values, which contain a mix of alphanumeric and special characters.

{
      "status"         : "OK",
      "pageTrackingId" : "523863900/4ubJYHs6gwcwUz9xCjCmng",
      "session"        : {
        "session" : "123456789012|a1b2c3d4e5A6B7C8D9E0f1g2h3i4j5F1G2H3I4J5k1l",
        "cuid"    : "09876543210|Z0Y9X8W7V6z5y4x3w2v1U0T9S8R7Q6u5t4s3r2q1P0O"
      }
    }

Store the cuid in persistent storage and send it to Optimizely in future requests so the same customer can be tracked across multiple sessions (see Storing customer IDs).

The rest of the response includes the appropriate response considering the information of the track and the client tailored customization for the site.