Guide
Smart Recommendations

Configurations

2min

If you haven't gone through the prerequisites and the v2 structure, please have a look at Overview

Merchants can create and manage multiple Klevu Recommendation banners via our KMC (Klevu Merchant Centre). The configuration via KMC includes the page type, the banner type and even the template to render the banner.

Our recommended approach to display these banners created via the KMC is to use our HTML Div Integration approach, which includes handling of API calls and banner rendering out of the box. You can also retrieve the KMC banner configuration via an API call and process it however you like.

This API call uses a simple GET request with no payload, and since it is intended for use on the frontend there is no authentication required

The end-point is used for retrieving the recommendation template configuration set in Klevu dashboard.
GET
Request
Path Params
BASE_PATH
optional
String
A static base url to retrieve Klevu Recommendation configuration from: https://config-cdn.ksearchnet.com
JS_API_KEY
optional
String
Your public Klevu JS API Key.
RECS_ID
optional
String
The unique ID of your Recommendation banner, which you can find within the KMC.
Query Parameters
pid
optional
String
The unique identifier of the record within Klevu.
gpid
optional
String
The identifier used to group compound products together, eg. the ID of the parent in the case of a configurable product
cp
optional
String
This is the complete hierarchy of the category being visited. For example, Jewellery;Rings;Stackable Rings. Please note the use of a semicolon as the separator between a parent and a child category.
sids
optional
String
The SegmentIDs (segmentInfo.segments) if using recommendation segmentation.
PHP
JS
Java
Node.js
Text
Responses
200


Understanding the response:

Parameters

Description

metadata.title

The title of the Recommendation Banner, eg. "Our newest arrivals!".

metadata.recsKey

The unique identifier of the banner. This will match the value of RECS_ID in the request, eg. 3a5580bf-c5b2-407e-acac-4a58ae730b64.

metadata.pageType

The page type this banner should be displayed on. This will be one of:

  • HOME: Homepage.
  • CATEGORY: Collection or Category Listing Page.
  • PRODUCT: Product Detail Page.
  • CHECKOUT: The Cart or Checkout.

metadata.logic

The type of recommendation banner which was configured in the KMC. This will be one of: TRENDING TRENDING_PERSONALIZED NEWEST_ARRIVALS RECENTLY_VIEWED HAND_PICKED OTHER_ALSO_VIEWED SIMILAR BOUGHT_TOGETHER

metadata.maxProducts

The maximum number of products to show within this banner.

metadata.productThreshold

The minimum number of results before this banner will be displayed.

metadata.enabled

Whether or not this particular banner is enabled.

search.basePath

The search URL to be used to send the Recommendation request to, eg. eucs19v2.ksearchnet.com/cs/v2/search.

search.payload

This correlates to the recordQueries section of the API call to be fired for this Recommendation.

templates.base

The HTML to be used for rendering the Recommendation banner, in Klevu JavaScript Library markup.

styles.base

The CSS that is used for rendering the Recommendation banner, in Klevu's Template JS Library markup.

scripts.recsObject

The Javascript that is executed after the rendering of the HTML Recommendation banner, in Klevu's Template JS Library markup.

Note regarding the response:

templates.base, styles.base, and scripts.recsObject returned in the configuration API response should not be used when using the API directly since they require the Klevu's Template JS Library.

Updated 22 Dec 2023
Doc contributor
Doc contributor
Doc contributor
Doc contributor
Did this page help you?