Update visitor tracking state and optionally request recommendations.
post
/v4/sessions/click
The contents of the request payload determine which actions are taken by the recommendations engine. Multiple actions can be performed within the same HTTP transaction. For example, a view object, a cart object, and a recommendations object can be provided in the same request to inform the recommendations engine that the shopper has visited a page or view, updated their cart, and that product recommendations are requested. Please see the accompanying documentation for additional examples.
Request
Supported Media Types
- application/json
Root Schema : schema
Type:
Show Source
object
-
cart(optional):
object cart
Provided when the users shopping cart changes. This informs the Recommendations service of the latest state of the users' cart.
-
catalogId(optional):
string
The catalog id currently in context for this user. This is used to ensure that only products from this catalog will be recommended.
-
checkout(optional):
object checkout
Provided when the user performs a checkout.
-
click(optional):
object click
Provided when the client detects that a user clicked on a recommended product.
-
profileId(optional):
string
The profile id of the user on whose behalf this request is being made. This allows for beter personalization of recommendations.
-
recommendations(optional):
object recommendations
Additional Properties Allowed: additionalPropertiesProvided when the application wants to get product recommendations for the user. Each child property of the "recommendations" object represents a request for a set of recommendations. The response will include a recommendation set for each of the child properties of "recommendations".
-
tenantId:
string
The id of the tenant for the request. Required.
-
token(optional):
string
An opaque token that was returned in a previous request. If this is the first request, the token can be omitted.
-
view(optional):
object view
Provided when the user changes page state. The strict definition is determined by the application, but the intent is that a view resource is sent on nearly every Recommendations request, as the user navigates through the application.
Example:
{
"tenantId":"p01234567c1PRD",
"token":"aaabbbcccddd",
"catalogId":"mysiteCatalog",
"profileId":"p273312",
"view":{
"url":"https://mysite.example.com/red-shirt/p32903",
"pageTitle":"Mysite: Red Shirt",
"referrer":"https://mysite.example.com",
"productId":"p32903"
},
"cart":{
"productIds":[
"p23312",
"p12199",
"p18442"
],
"totalPrice":3923.62,
"pricelistGroupId":"base",
"currencyCode":"INR"
},
"recommendations":{
"first":{
"numRecs":6,
"strategyId":"inCategory"
},
"second":{
"numRecs":8,
"strategyId":"topSellers"
}
}
}
Nested Schema : cart
Type:
object
Provided when the users shopping cart changes. This informs the Recommendations service of the latest state of the users' cart.
Show Source
-
currencyCode(optional):
string
The ISO currency code of the prices in this cart.
-
pricelistGroupId(optional):
string
The id of the price list group used to price this cart.
-
productIds(optional):
array productIds
An array of productIds that are currently in the visitor's cart.
-
totalPrice(optional):
number
The total price of the products in the cart.
Nested Schema : checkout
Type:
object
Provided when the user performs a checkout.
Show Source
-
currencyCode(optional):
string
The currency code used for the prices in this checkout.
-
pricelistGroupId(optional):
string
The Commerce Cloud price list used for this checkout.
-
products(optional):
array products
-
totalPrice(optional):
number
The total price paid for the entire checkout.
Nested Schema : click
Type:
object
Provided when the client detects that a user clicked on a recommended product.
Show Source
-
productId(optional):
string
The id of the product that was clicked.
-
recSetId(optional):
string
The recommendations set id that contains the recommendations that was clicked. This value is included in the response to requests for recommendations.
Nested Schema : recommendations
Type:
object
Additional Properties Allowed
Show Source
Provided when the application wants to get product recommendations for the user. Each child property of the "recommendations" object represents a request for a set of recommendations. The response will include a recommendation set for each of the child properties of "recommendations".
Example:
{
"recommendations":{
"first":{
"numRecs":6,
"strategyId":"inCategoryShoes"
},
"second":{
"numRecs":6,
"strategyId":"upsellAccessories"
}
}
}
Nested Schema : view
Type:
object
Provided when the user changes page state. The strict definition is determined by the application, but the intent is that a view resource is sent on nearly every Recommendations request, as the user navigates through the application.
Show Source
-
brand(optional):
string
If in the context of viewing a brand, the name of that brand.
-
category(optional):
string
If in the context of viewing a category, the path of that category in the catalog, using the greater-than symbol as a seperator.
-
pageTitle(optional):
string
The name of the page being viewed.
-
productId(optional):
string
If in the context of viewing a product, the id of that product.
-
referrer(optional):
string
The URL of the page that led the shopper to the current page.
-
searchText(optional):
string
If on a search results page, or from an external search engine, the text used to perform the search.
-
url:
string
The URL of the page that the visitor is browsing.
Nested Schema : productIds
Type:
array
An array of productIds that are currently in the visitor's cart.
Show Source
Nested Schema : items
Type:
Show Source
object
-
price(optional):
number
The price paid for this product.
-
productId(optional):
string
The id of the product in the checkout.
-
quantity(optional):
number
The quantity of the line item of this product.
Nested Schema : additionalProperties
Type:
Show Source
object
-
numRecs(optional):
number
The maximum number of recommendations to return.
-
strategyId(optional):
string
The id of the strategy previously defined in the Strategy Builder in the Commerce Cloud Admin UI. Omitting this allows the Recommender to choose personalized recommendations based on observed behavior.
Response
Supported Media Types
- application/json
200 Response
A successful tracking and recommendations response.
Root Schema : schema
Type:
Show Source
object
-
recommendations(optional):
object recommendations
If the request included the "recommendations" property, this will contain the recommended products.
-
token(optional):
string
A state token which should be included in the next request payload.
Nested Schema : recommendations
Type:
object
If the request included the "recommendations" property, this will contain the recommended products.
Show Source
-
recs(optional):
array recs
Prouducts in this recommendation set.
-
recSetId(optional):
string
The recommendation set id. If a recommendation in this set is selected, this recommendation set id should be provided in the "click" payload of the subsequent request.
Nested Schema : recs
Type:
array
Prouducts in this recommendation set.
Show Source
-
Array of:
object items
A recommended product. Additional details (including name and image URL) can be obtained from the Commerce Cloud Storefront server.
Nested Schema : items
Type:
object
A recommended product. Additional details (including name and image URL) can be obtained from the Commerce Cloud Storefront server.
Show Source
-
productId(optional):
string
The id of the recommended product.
Example Response (application/json)
{
"token":"aaabbbcccddd",
"recommendations":{
"first":{
"recSetId":"2234d234:234-1",
"recs":[
{
"productId":"p1113"
},
{
"productId":"p1277"
},
{
"productId":"p4942"
},
{
"productId":"p8832"
},
{
"productId":"p0012"
}
]
},
"second":{
"recSetId":"83249920:223-5",
"recs":[
{
"productId":"p1873"
},
{
"productId":"p5521"
},
{
"productId":"p0022"
},
{
"productId":"p1211"
},
{
"productId":"p4910"
}
]
}
}
}