Recently Viewed
2 min
If you haven't gone through the prerequisites and the v2 structure, please have a look at Overview
Klevu can power a recommendation banner showcasing any products which the customer has recently viewed. The most common placements for this banner type are:
Homepage: Recently Viewed By You Show a recommendation banner with products the current customer has recently viewed.
Recently Viewed Product Recommendations
The end-point is used for retrieving recently viewed product recommendations.
POST
https://eucs19v2.ksearchnet.com/cs/v2/search
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://eucs19v2.ksearchnet.com/cs/v2/search',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"recordQueries": [
{
"id": "recsRecentlyViewed",
"typeOfRequest": "SEARCH",
"settings": {
"customANDQuery":"(id:\\"34322453430403\\" OR id:\\"34322423840899\\")",
"topIds": [
{
"key": "id",
"value": "34322453430403"
},
{
"key": "id",
"value": "34322423840899"
}
],
"typeOfRecords": [
"KLEVU_PRODUCT"
]
}
}
],
"context": {
"apiKeys": [
"klevu-158755634955912036"
]
}
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;Try it here!