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
Body ()
Root Schema : schema
Type: object
Show Source
  • cart
    Provided when the users shopping cart changes. This informs the Recommendations service of the latest state of the users' cart.
  • The catalog id currently in context for this user. This is used to ensure that only products from this catalog will be recommended.
  • checkout
    Provided when the user performs a checkout.
  • click
    Provided when the client detects that a user clicked on a recommended product.
  • The profile id of the user on whose behalf this request is being made. This allows for beter personalization of recommendations.
  • recommendations
    Additional Properties Allowed: additionalProperties
    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".
  • The id of the tenant for the request. Required.
  • An opaque token that was returned in a previous request. If this is the first request, the token can be omitted.
  • 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
Nested Schema : checkout
Type: object
Provided when the user performs a checkout.
Show Source
Nested Schema : click
Type: object
Provided when the client detects that a user clicked on a recommended product.
Show Source
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
Nested Schema : productIds
Type: array
An array of productIds that are currently in the visitor's cart.
Show Source
Nested Schema : products
Type: array
Show Source
Nested Schema : items
Type: object
Show Source
Nested Schema : additionalProperties
Type: object
Show Source
  • The maximum number of recommendations to return.
  • 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.
Back to Top

Response

Supported Media Types

200 Response

A successful tracking and recommendations response.
Body ()
Root Schema : schema
Type: object
Show Source
Nested Schema : recommendations
Type: object
If the request included the "recommendations" property, this will contain the recommended products.
Show Source
Nested Schema : recs
Type: array
Prouducts in this recommendation set.
Show Source
  • 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
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"
                }
            ]
        }
    }
}
Back to Top