Recommendations Events
1 min
Reporting Recommendation Impressions
The end-point is used for reporting banner product views.
POST
https://{{ Analytics_URL }}/analytics/collect
Body Parameters
- eventstringrequiredDescription
- event_apikey stringrequiredDescription
- event_list_idstringrequiredDescription
- event_list_namestringrequiredDescription
- event_list_logicstringrequiredDescription
- event_tagsArrayDescription
- user_profileObjectrequiredDescription
- ip_addressstringrequiredDescription
- ip_address_v4stringDescription
- ip_address_v6stringDescription
- data_protectionBooleanDescription
- klevu_uuidstringDescription
- klevu_countrystringDescription
- klevu_citystringDescription
- itemsArrayrequiredDescription
- item_idstringrequiredDescription
- item_group_idstringrequiredDescription
- item_variant_idstringrequiredDescription
- item_namestringrequiredDescription
- priceNumberrequiredDescription
- currencystringDescription
- item_brandstringDescription
- item_categorystringDescription
- indexIntegerrequiredDescription
php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://stats.ksearchnet.com/analytics/collect',
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 =>'[
{
"event": "view_recs_list",
"event_apikey": "klevu-12345",
"event_list_id": "12345-abcde",
"event_tags": [
"recsPageType:category"
],
"event_list_name": "New Arrivals",
"event_list_logic": "NEWEST_ARRIVALS",
"user_profile" : {
"ip_address":"111.11.11.1"
},
"items": [
{
"item_id": "12345-54321",
"item_group_id": "12345",
"item_variant_id": "54321",
"item_name": "Hoodie Sweatshirt",
"price": "123.45",
"currency": "GBP",
"item_brand": "Acme",
"item_category": "All;;Coats & Jackets;;Womens Coats",
"index": 1
}
]
},
{
"event": "select_recs_list",
"event_apikey": "klevu-12345",
"event_list_id": "12345-abcde",
"event_tags": [
"recsPageType:category"
],
"event_list_name": "New Arrivals",
"event_list_logic": "NEWEST_ARRIVALS",
"user_profile" : {
"ip_address":"111.11.11.1"
},
"items": [
{
"item_id": "12345-54321",
"item_group_id": "12345",
"item_variant_id": "54321",
"item_name": "Hoodie Sweatshirt",
"price": "123.45",
"currency": "GBP",
"item_brand": "Acme",
"item_category": "All;;Coats & Jackets;;Womens Coats",
"index": 1
}
]
}
]',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
javascript
var data = JSON.stringify([{"event":"view_recs_list","event_apikey":"klevu-12345","event_list_id":"12345-abcde","event_tags":["recsPageType:category"],"event_list_name":"New Arrivals","event_list_logic":"NEWEST_ARRIVALS","user_profile" : {"ip_address":"111.11.11.1"},"items":[{"item_id":"12345-54321","item_group_id":"12345","item_variant_id":"54321","item_name":"Hoodie Sweatshirt","price":"123.45","currency":"GBP","item_brand":"Acme","item_category":"All;;Coats & Jackets;;Womens Coats","index":1}]},{"event":"select_recs_list","event_apikey":"klevu-12345","event_list_id":"12345-abcde","event_tags":["recsPageType:category"],"event_list_name":"New Arrivals","event_list_logic":"NEWEST_ARRIVALS","items":[{"item_id":"12345-54321","item_group_id":"12345","item_variant_id":"54321","item_name":"Hoodie Sweatshirt","price":"123.45","currency":"GBP","item_brand":"Acme","item_category":"All;;Coats & Jackets;;Womens Coats","index":1}]}]);
var xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://stats.ksearchnet.com/analytics/collect");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "[\n {\n \"event\": \"view_recs_list\",\n \"event_apikey\": \"klevu-12345\",\n \"event_list_id\": \"12345-abcde\",\n \"event_tags\": [\n \"recsPageType:category\"\n ],\n \"event_list_name\": \"New Arrivals\",\n \"event_list_logic\": \"NEWEST_ARRIVALS\",\n \"user_profile\" : {\"ip_address\":\"111.11.11.1\"},\n \"items\": [\n {\n \"item_id\": \"12345-54321\",\n \"item_group_id\": \"12345\",\n \"item_variant_id\": \"54321\",\n \"item_name\": \"Hoodie Sweatshirt\",\n \"price\": \"123.45\",\n \"currency\": \"GBP\",\n \"item_brand\": \"Acme\",\n \"item_category\": \"All;;Coats & Jackets;;Womens Coats\",\n \"index\": 1\n }\n ]\n },\n {\n \"event\": \"select_recs_list\",\n \"event_apikey\": \"klevu-12345\",\n \"event_list_id\": \"12345-abcde\",\n \"event_tags\": [\n \"recsPageType:category\"\n ],\n \"event_list_name\": \"New Arrivals\",\n \"event_list_logic\": \"NEWEST_ARRIVALS\",\n \"items\": [\n {\n \"item_id\": \"12345-54321\",\n \"item_group_id\": \"12345\",\n \"item_variant_id\": \"54321\",\n \"item_name\": \"Hoodie Sweatshirt\",\n \"price\": \"123.45\",\n \"currency\": \"GBP\",\n \"item_brand\": \"Acme\",\n \"item_category\": \"All;;Coats & Jackets;;Womens Coats\",\n \"index\": 1\n }\n ]\n }\n]");
Request request = new Request.Builder()
.url("https://stats.ksearchnet.com/analytics/collect")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();nodejs
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://stats.ksearchnet.com/analytics/collect',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify([{"event":"view_recs_list","event_apikey":"klevu-12345","event_list_id":"12345-abcde","event_tags":["recsPageType:category"],"event_list_name":"New Arrivals","event_list_logic":"NEWEST_ARRIVALS","user_profile" : {"ip_address":"111.11.11.1"},"items":[{"item_id":"12345-54321","item_group_id":"12345","item_variant_id":"54321","item_name":"Hoodie Sweatshirt","price":"123.45","currency":"GBP","item_brand":"Acme","item_category":"All;;Coats & Jackets;;Womens Coats","index":1}]},{"event":"select_recs_list","event_apikey":"klevu-12345","event_list_id":"12345-abcde","event_tags":["recsPageType:category"],"event_list_name":"New Arrivals","event_list_logic":"NEWEST_ARRIVALS","items":[{"item_id":"12345-54321","item_group_id":"12345","item_variant_id":"54321","item_name":"Hoodie Sweatshirt","price":"123.45","currency":"GBP","item_brand":"Acme","item_category":"All;;Coats & Jackets;;Womens Coats","index":1}]}])
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
200
Reporting Banner Product Clicks
The end-point is used for reporting banner product clicks.
POST
https://{{ Analytics_URL }}/analytics/collect
Body Parameters
- eventstringrequiredDescription
- event_apikey stringrequiredDescription
- event_list_idstringrequiredDescription
- event_list_namestringrequiredDescription
- event_list_logicstringrequiredDescription
- event_tagsArrayDescription
- user_profileObjectrequiredDescription
- ip_addressstringrequiredDescription
- ip_address_v4stringDescription
- ip_address_v6stringDescription
- data_protectionBooleanDescription
- klevu_uuidstringDescription
- klevu_countrystringDescription
- klevu_citystringDescription
- itemsArrayrequiredDescription
- item_idstringrequiredDescription
- item_group_idstringrequiredDescription
- item_variant_idstringrequiredDescription
- item_namestringrequiredDescription
- priceNumberrequiredDescription
- currencystringDescription
- item_brandstringDescription
- item_categorystringDescription
- indexIntegerrequiredDescription
php
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://stats.ksearchnet.com/analytics/collect',
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 =>'[
{
"event": "view_recs_list",
"event_apikey": "klevu-12345",
"event_list_id": "12345-abcde",
"event_tags": [
"recsPageType:category"
],
"event_list_name": "New Arrivals",
"event_list_logic": "NEWEST_ARRIVALS",
"user_profile" : {
"ip_address":"111.11.11.1"
},
"items": [
{
"item_id": "12345-54321",
"item_group_id": "12345",
"item_variant_id": "54321",
"item_name": "Hoodie Sweatshirt",
"price": "123.45",
"currency": "GBP",
"item_brand": "Acme",
"item_category": "All;;Coats & Jackets;;Womens Coats",
"index": 1
}
]
},
{
"event": "select_recs_list",
"event_apikey": "klevu-12345",
"event_list_id": "12345-abcde",
"event_tags": [
"recsPageType:category"
],
"event_list_name": "New Arrivals",
"event_list_logic": "NEWEST_ARRIVALS",
"user_profile" : {
"ip_address":"111.11.11.1"
},
"items": [
{
"item_id": "12345-54321",
"item_group_id": "12345",
"item_variant_id": "54321",
"item_name": "Hoodie Sweatshirt",
"price": "123.45",
"currency": "GBP",
"item_brand": "Acme",
"item_category": "All;;Coats & Jackets;;Womens Coats",
"index": 1
}
]
}
]',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
javascript
var data = JSON.stringify([{"event":"view_recs_list","event_apikey":"klevu-12345","event_list_id":"12345-abcde","event_tags":["recsPageType:category"],"event_list_name":"New Arrivals","event_list_logic":"NEWEST_ARRIVALS","user_profile" : {"ip_address":"111.11.11.1"},"items":[{"item_id":"12345-54321","item_group_id":"12345","item_variant_id":"54321","item_name":"Hoodie Sweatshirt","price":"123.45","currency":"GBP","item_brand":"Acme","item_category":"All;;Coats & Jackets;;Womens Coats","index":1}]},{"event":"select_recs_list","event_apikey":"klevu-12345","event_list_id":"12345-abcde","event_tags":["recsPageType:category"],"event_list_name":"New Arrivals","event_list_logic":"NEWEST_ARRIVALS","items":[{"item_id":"12345-54321","item_group_id":"12345","item_variant_id":"54321","item_name":"Hoodie Sweatshirt","price":"123.45","currency":"GBP","item_brand":"Acme","item_category":"All;;Coats & Jackets;;Womens Coats","index":1}]}]);
var xhr = new XMLHttpRequest();
xhr.withCredentials = false;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://stats.ksearchnet.com/analytics/collect");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.send(data);java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "[\n {\n \"event\": \"view_recs_list\",\n \"event_apikey\": \"klevu-12345\",\n \"event_list_id\": \"12345-abcde\",\n \"event_tags\": [\n \"recsPageType:category\"\n ],\n \"event_list_name\": \"New Arrivals\",\n \"event_list_logic\": \"NEWEST_ARRIVALS\",\n \"user_profile\" : {\"ip_address\":\"111.11.11.1\"},\n \"items\": [\n {\n \"item_id\": \"12345-54321\",\n \"item_group_id\": \"12345\",\n \"item_variant_id\": \"54321\",\n \"item_name\": \"Hoodie Sweatshirt\",\n \"price\": \"123.45\",\n \"currency\": \"GBP\",\n \"item_brand\": \"Acme\",\n \"item_category\": \"All;;Coats & Jackets;;Womens Coats\",\n \"index\": 1\n }\n ]\n },\n {\n \"event\": \"select_recs_list\",\n \"event_apikey\": \"klevu-12345\",\n \"event_list_id\": \"12345-abcde\",\n \"event_tags\": [\n \"recsPageType:category\"\n ],\n \"event_list_name\": \"New Arrivals\",\n \"event_list_logic\": \"NEWEST_ARRIVALS\",\n \"items\": [\n {\n \"item_id\": \"12345-54321\",\n \"item_group_id\": \"12345\",\n \"item_variant_id\": \"54321\",\n \"item_name\": \"Hoodie Sweatshirt\",\n \"price\": \"123.45\",\n \"currency\": \"GBP\",\n \"item_brand\": \"Acme\",\n \"item_category\": \"All;;Coats & Jackets;;Womens Coats\",\n \"index\": 1\n }\n ]\n }\n]");
Request request = new Request.Builder()
.url("https://stats.ksearchnet.com/analytics/collect")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();nodejs
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://stats.ksearchnet.com/analytics/collect',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify([{"event":"view_recs_list","event_apikey":"klevu-12345","event_list_id":"12345-abcde","event_tags":["recsPageType:category"],"event_list_name":"New Arrivals","event_list_logic":"NEWEST_ARRIVALS","user_profile" : {"ip_address":"111.11.11.1"},"items":[{"item_id":"12345-54321","item_group_id":"12345","item_variant_id":"54321","item_name":"Hoodie Sweatshirt","price":"123.45","currency":"GBP","item_brand":"Acme","item_category":"All;;Coats & Jackets;;Womens Coats","index":1}]},{"event":"select_recs_list","event_apikey":"klevu-12345","event_list_id":"12345-abcde","event_tags":["recsPageType:category"],"event_list_name":"New Arrivals","event_list_logic":"NEWEST_ARRIVALS","items":[{"item_id":"12345-54321","item_group_id":"12345","item_variant_id":"54321","item_name":"Hoodie Sweatshirt","price":"123.45","currency":"GBP","item_brand":"Acme","item_category":"All;;Coats & Jackets;;Womens Coats","index":1}]}])
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
200