List of APIs
Search APIs
Search
Search Navigations
Null Search Terms
Search Term Performance
Search Products
Trending Searches
post

/recommendations/products/alsoViewed

Oftentimes when customers are shopping for a particular item, or even just browsing around, they will probably only click on the first few options in the results. There might be many other relevant items that they have not seen, either buried in the results or hiding right there in plain sight, that they might like.

This is where this API comes in. By leveraging the data gathered from your beacons to empower a machine learning model, and the product data uploaded to search, it will recommend products related to a given product (parent product) based on user behavior.

Authorization

apiKey - authorization

Request Body

1 Example
Schema
object
productID
string

The ID of the parent product (productID) that you would like to get recommendations for. This API will not work with SKU IDs.

required
area
string

The area you wish to fire against, production, staging, etc…

1 validation + required
collection
string

The collection to use. This is case sensitive and should be same as your collection name.

1 validation + required
visitorID
string

visitorId is a unique string identifier of an end customer, unique to a device.

As described in the Session ID section, the tracker sets cookies in the browser and these cookies can be used to identify a session or a user. These cookie values can be used to identify a user when making API calls or sending beacons and tailor experiences to the user.

This field must be consistent between the Search and Recommendations APIs to ensure correct monitoring of conversion metrics.

Note: Visitor IDs expire after 10 years, unless cookies are deleted by the user. Visitor ID should remain the same for a particular customer over different sessions while using the same device.

You can get the visitor ID value by using the getVisitorId function on the tracker: var visitorId = gbTracker.getVisitorId() or by accessing first party cookies using gbi_visitorId.

1 validation + required
loginID
string

loginId is a unique string identifier of an end customer, unique to a login instance. This ID can be used to track a user across multiple devices. (eg. mobile and desktop)

The Login ID is not set by the tracker client and stored but must be set upon successful login of the user. This ID can be generated by hashing a unique identifier of the end user, such as username or email address. As long as the user’s identity can be mapped across devices, this value can be set arbitrarily but must be the same for the same user logged in on two different devices.

Once a user is logged in the hash of their unique identifier can be stored in a cookie as such: gbTracker.autoSetVisitor('login_id');. Once set, the login ID can be retrieved similar to the other two IDs: var loginId = gbTracker.getLoginId()

or by accessing first party cookies using gbi_loginId.

1 validation
fields
array[string]

Specify which fields should be returned on each record that comes back from the engine. You may specify more than one field, if you specify fields as ["*"], then all fields will be returned. If this parameter is omitted, the service will return only the title field. The title field is always returned. You can exclude fields from being returned using -. Exclusion will take precedence over inclusion.

1 validation

Responses

Note: The fields in the product object will vary depending upon the fields you’ve requested in fields array in the request body.

1 Example
Schema
object
products
array[object]
metadata
object

Send a Test Request

Send requests directly from the browser (CORS must be enabled)
$$.env
6 variables not set
customerid
authorization
area
collection
productID
visitorID