Guide
Analytics Tracking
Search Events
1 min
{ "tab" "examples", "url" "https //{{ analytics url }}/analytics/n search/search", "name" "reporting product searches", "method" "get", "request" { "pathparameters" \[], "queryparameters" \[ { "kind" "required", "name" "klevu apikey", "type" "string", "description" "this is your klevu js api key " }, { "kind" "required", "name" "klevu term", "type" "string", "description" "this is the term being searched for example iphone 5s \n\n for tracking of a facet click, append the selected facet to the term \ne g iphone 5s \[\[color\ black]]" }, { "kind" "required", "name" "klevu totalresults", "type" "string", "description" "this is the total number of results returned for the searched term it must be an integer (e g 5)" }, { "kind" "required", "name" "klevu typeofquery", "type" "string", "description" "when you receive a response for a search query, look at the value of the typeofquery element under the metadata section (e g wildcard and, fuzzy and) you need to pass this value to this parameter " }, { "kind" "required", "name" "klevu shopperip", "type" "string", "description" "ip address of the shopper who searched a term \n\n if calling from javascript (i e an ajax call), this is an optional parameter " }, { "name" "klevu shopperip v4", "kind" "optional", "type" "string", "description" "ipv4 address of the shopper who searched a term \n", "children" \[] }, { "name" "klevu shopperip v6", "kind" "optional", "type" "string", "description" "ipv6 address of the shopper who searched a term ", "children" \[] }, { "name" "data protection", "kind" "optional", "type" "boolean", "description" "if set to false, klevu's backend do not obtain the shoppers' ip address the default value is true ", "children" \[] }, { "name" "klevu uuid", "kind" "optional", "type" "string", "description" "universally unique identifier generated by klevu, it can be also considered as session id please obtain uuid using end point https //docs klevu com/apis/uuid", "children" \[] }, { "name" "klevu country", "kind" "optional", "type" "string", "description" "2 digit country code of the shopper who searched a term valid codes can be found at https //developers google com/hotels/hotel prices/dev guide/country codes", "children" \[] }, { "name" "klevu city", "kind" "optional", "type" "string", "description" "city name of the shopper who searched a term ", "children" \[] } ], "headerparameters" \[], "bodydataparameters" \[], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "ddxomvwnislr jx48ghqd", "code" "\<data>\n \<response>success\</response>\n\</data>", "language" "200", "customlabel" "" } ], "selectedlanguageid" "ddxomvwnislr jx48ghqd" }, "examples" { "languages" \[ { "id" "ewnrzcoksk8s4pdjfvhym", "code" "curl location request get 'https //stats ksearchnet com/analytics/n search/search?apikey=klevu 1234567890\&term=red%20shoes\&klevu totalresults=35\&klevu typeofquery=wildcard and'", "language" "curl", "customlabel" "" }, { "id" "eqqdeuhwckdcwovoowpgc", "code" "var request = require('request');\nvar options = {\n 'method' 'get',\n 'url' 'https //stats ksearchnet com/analytics/n search/search?apikey=klevu 1234567890\&term=red%20shoes\&klevu totalresults=35\&klevu typeofquery=wildcard and',\n 'headers' {\n }\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "language" "nodejs", "customlabel" "" }, { "id" "8jgvxehuuib8hjb3wwgyb", "code" "var requestoptions = {\n method 'get',\n redirect 'follow'\n};\n\nfetch(\\"https //stats ksearchnet com/analytics/n search/search?klevu apikey=klevu 1234567890\&klevu term=red%20shoes\&klevu totalresults=35\&klevu typeofquery=wildcard and\\", requestoptions)\n then(response => response text())\n then(result => console log(result))\n catch(error => console log('error', error));", "language" "javascript", "customlabel" "" }, { "id" "6dgdwewxlcomg0snanahm", "code" "import requests\n\nurl = \\"https //stats ksearchnet com/analytics/n search/search?apikey=klevu 1234567890\&term=red%20shoes\&klevu totalresults=35\&klevu typeofquery=wildcard and\\"\n\npayload={}\nheaders = {}\n\nresponse = requests request(\\"get\\", url, headers=headers, data=payload)\n\nprint(response text)\n", "language" "python", "customlabel" "" }, { "id" "zx8 wo0tig8ycfpmpqeio", "code" "require \\"uri\\"\nrequire \\"net/http\"\n\nurl = uri(\\"https //stats ksearchnet com/analytics/n search/search?apikey=klevu 1234567890\&term=red%20shoes\&klevu totalresults=35\&klevu typeofquery=wildcard and\\")\n\nhttps = net http new(url host, url port)\nhttps use ssl = true\n\nrequest = net http get new(url)\n\nresponse = https request(request)\nputs response read body\n", "language" "ruby", "customlabel" "" } ], "selectedlanguageid" "8jgvxehuuib8hjb3wwgyb" }, "description" "use this api endpoint to submit the search activities \n1 when the search response is received\n2 and also when a facet is clicked (triggering a follow up query)\n\n", "currentnewparameter" { "label" "query parameter", "value" "queryparameters" } } { "tab" "examples", "url" "https //{{ analytics url }}/analytics/producttracking", "name" "reporting product clicks from search results", "method" "get", "request" { "pathparameters" \[], "queryparameters" \[ { "kind" "required", "name" "klevu apikey", "type" "string", "description" "this is your klevu js api key " }, { "kind" "required", "name" "klevu keywords", "type" "string", "description" "this is the term being searched for example iphone 5s \n\n for tracking of a facet click, append the selected facet to the term \ne g iphone 5s \[\[color\ black]]" }, { "kind" "required", "name" "klevu type", "type" "string", "description" "this is constant value the value must be clicked " }, { "kind" "required", "name" "klevu productid", "type" "string", "description" "this is the klevu id of the clicked product eg 54321 12345 " }, { "kind" "required", "name" "klevu productgroupid", "type" "string", "description" "this is the parent id of the clicked product eg 54321 for compound products with a parent and multiple child/variant products, this is the common id which ties the products together for simple products, please specify the same as klevu productid " }, { "kind" "required", "name" "klevu productvariantid", "type" "string", "description" "this is the child/variant id of the clicked product eg 12345 for compound products with a parent and multiple child/variant products, this is the id of the specific variant for simple products, please specify the same as klevu productid " }, { "kind" "required", "name" "klevu productname", "type" "string", "description" "this is the product name of the clicked product " }, { "kind" "required", "name" "klevu producturl", "type" "string", "description" "this is the product url of the clicked product " }, { "kind" "required", "name" "klevu shopperip", "type" "string", "description" "ip address of the shopper who clicked on a product \n\n if calling from javascript (i e an ajax call), this is an optional parameter " }, { "name" "klevu shopperip v4", "kind" "optional", "type" "string", "description" "ipv4 address of the shopper who clicked a product \n", "children" \[] }, { "name" "klevu shopperip v6", "kind" "optional", "type" "string", "description" "ipv6 address of the shopper who clicked a product ", "children" \[] }, { "name" "data protection", "kind" "optional", "type" "boolean", "description" "if set to false, klevu's backend do not obtain the shoppers' ip address the default value is true ", "children" \[] }, { "name" "klevu uuid", "kind" "optional", "type" "string", "description" "universally unique identifier generated by klevu, it can be also considered as session id please obtain uuid using end point https //docs klevu com/apis/uuid", "children" \[] }, { "name" "klevu country", "kind" "optional", "type" "string", "description" "2 digit country code of the shopper who searched a term valid codes can be found at https //developers google com/hotels/hotel prices/dev guide/country codes", "children" \[] }, { "name" "klevu city", "kind" "optional", "type" "string", "description" "city name of the shopper who clicked a product ", "children" \[] } ], "headerparameters" \[], "bodydataparameters" \[], "formdataparameters" \[] }, "results" { "languages" \[ { "id" "ddxomvwnislr jx48ghqd", "code" "\<data>\n \<response>success\</response>\n\</data>", "language" "200", "customlabel" "" } ], "selectedlanguageid" "ddxomvwnislr jx48ghqd" }, "examples" { "languages" \[ { "id" "ewnrzcoksk8s4pdjfvhym", "code" "\<?php\n\n$curl = curl init();\n\ncurl setopt array($curl, array(\n curlopt url => 'https //stats ksearchnet com/analytics/producttracking?klevu apikey=klevu 1234567890\&klevu keywords=red%2520shoes\&klevu type=clicked\&klevu productid=54321 12345\&klevu productgroupid=54321\&klevu productvariantid=12345\&klevu productname=smart%2520trainers\&klevu producturl=https%253a%252f%252fyour website com%252fproduct url',\n curlopt returntransfer => true,\n curlopt encoding => '',\n curlopt maxredirs => 10,\n curlopt timeout => 0,\n curlopt followlocation => true,\n curlopt http version => curl http version 1 1,\n curlopt customrequest => 'get',\n));\n\n$response = curl exec($curl);\n\ncurl close($curl);\necho $response;\n", "language" "curl", "customlabel" "" }, { "id" "eqqdeuhwckdcwovoowpgc", "code" "var request = require('request');\nvar options = {\n 'method' 'get',\n 'url' 'https //stats ksearchnet com/analytics/producttracking?klevu apikey=klevu 1234567890\&klevu keywords=red%20shoes\&klevu type=clicked\&klevu productid=54321 12345\&klevu productgroupid=54321\&klevu productvariantid=12345\&klevu productname=smart%20trainers\&klevu producturl=https%3a%2f%2fyour website com%2fproduct url',\n 'headers' {\n }\n};\nrequest(options, function (error, response) {\n if (error) throw new error(error);\n console log(response body);\n});\n", "language" "nodejs", "customlabel" "" }, { "id" "8jgvxehuuib8hjb3wwgyb", "code" "var xhr = new xmlhttprequest();\nxhr withcredentials = false;\n\nxhr addeventlistener(\\"readystatechange\\", function() {\n if(this readystate === 4) {\n console log(this responsetext);\n }\n});\n\nxhr open(\\"get\\", \\"https //stats ksearchnet com/analytics/producttracking?klevu apikey=klevu 1234567890\&klevu keywords=red%2520shoes\&klevu type=clicked\&klevu productid=54321 12345\&klevu productgroupid=54321\&klevu productvariantid=12345\&klevu productname=smart%2520trainers\&klevu producturl=https%253a%252f%252fyour website com%252fproduct url\\");\n\nxhr send();", "language" "javascript", "customlabel" "" }, { "id" "6dgdwewxlcomg0snanahm", "code" "import requests\n\nurl = \\"https //stats ksearchnet com/analytics/producttracking?klevu apikey=klevu 1234567890\&klevu keywords=red%20shoes\&klevu type=clicked\&klevu productid=54321 12345\&klevu productgroupid=54321\&klevu productvariantid=12345\&klevu productname=smart%20trainers\&klevu producturl=https%3a%2f%2fyour website com%2fproduct url\\"\n\npayload={}\nheaders = {}\n\nresponse = requests request(\\"get\\", url, headers=headers, data=payload)\n\nprint(response text)\n", "language" "python", "customlabel" "" }, { "id" "zx8 wo0tig8ycfpmpqeio", "code" "require \\"uri\\"\nrequire \\"net/http\"\n\nurl = uri(\\"https //stats ksearchnet com/analytics/producttracking?klevu apikey=klevu 1234567890\&klevu keywords=red%20shoes\&klevu type=clicked\&klevu productid=54321 12345\&klevu productgroupid=54321\&klevu productvariantid=12345\&klevu productname=smart%20trainers\&klevu producturl=https%3a%2f%2fyour website com%2fproduct url\\")\n\nhttps = net http new(url host, url port)\nhttps use ssl = true\n\nrequest = net http get new(url)\n\nresponse = https request(request)\nputs response read body\n", "language" "ruby", "customlabel" "" } ], "selectedlanguageid" "8jgvxehuuib8hjb3wwgyb" }, "description" "use this api endpoint to submit the product clicks from search results \n", "currentnewparameter" { "label" "query parameter", "value" "queryparameters" } }