Server-to-Server API Integration Guide
Server-to-Server API
Using this integration method, you call the HTTP endpoints directly to integrate with the core recommendations tracking API. The Server-to-Server API lets clients integrate their servers or applications with Optimizely Recommendations products.
Store customer IDs
To associate visitors’ subsequent sessions with their customer ID, you need to persistently store each CUID (consolidated user ID) on your server and pass it back to Optimizely the next time the customer visits your website. Otherwise, if you specify new every time, or for every new session, Optimizely creates a new CUID for each visit/session and cannot relate visits by the same customer.
Request message reference
You can access the RESTful service on the Optimizely LIVE server by a POST or GET https request using the following request URL https //\<clientname>. productrecs.
Tracking request format
The following sections show the structure common to all requests, then the additional elements needed for each request type, with examples. Common elements https //docs.
Variant tracking
For the variant value, you should use the product variant’s SKU. Alternatively, you can supply attributes of the variant.
Click tracking
To generate useful recommendations, clicks on recommended content must be sent to Optimizely servers. Supply this information in an info element.
Link to a specific basket
Consider the following main areas Changes to basket page tracking. Steps for the Email Service Provider (ESP).
Response message
The response message has the following properties 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.
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.
Product Recommendations response
If Optimizely Product Recommendations were configured by Optimizely for a page being tracked, a list of product recommendations is returned in the message. The contents are returned in the smartRecs element at the root of the JSON response.
Render product recommendations
You can render product recommendations returned in the response in different ways, depending on your website/ecommerce platform. You may implement rendering in one of two ways.
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. To request full A/B test information, set the abTestContent attribute in the tracking request to full, as shown below.
Error codes
The following list shows error codes for the mandatory elements missing per page type. The mandatory nature of these elements is conditional to the type property of the message.
Migrate Server-to-server API 1.2 to 1.3
The API response will always contain the pageTrackingId parameter. You can use this information when tracking on page dynamic searches or Personalized Search & Navigation (legacy) requests.
Migrate Server-to-server API 1.3 to 1.4
To use version 1. 4, specify the correct version number in the request URL, as shown in the following example.