---
title: Category Events
slug: apis/category-events
docTags: 
createdAt: 2024-06-25T00:28:53.534Z
---



:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://{{ Analytics_URL }}/analytics/categoryProductViewTracking",
  "name": "Reporting Category Page Views",
  "method": "GET",
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "kind": "required",
        "name": "klevu_apiKey",
        "type": "string",
        "description": "This is your Klevu JS API Key."
      },
      {
        "kind": "required",
        "name": "klevu_categoryName",
        "type": "string",
        "description": "This is the name of the category being visited. For example, Stackable Rings. The name should not include parent categories."
      },
      {
        "kind": "required",
        "name": "klevu_categoryPath",
        "type": "string",
        "description": "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."
      },
      {
        "kind": "required",
        "name": "klevu_productIds",
        "type": "string",
        "description": "Comma separated list of product IDs being shown on the current page of the category page. For example, P1,P2,P3,P4,P5…\nAll the product IDs listed here are treated as impressions for these products."
      },
      {
        "kind": "optional",
        "name": "klevu_pageStartsFrom",
        "type": "string",
        "description": "Offset of the first product being shown on this page. For example, if you are displaying 30 products per page and if a customer is on the 2nd page, the value here should be 30. If on the 3rd page, it will be 60."
      },
      {
        "kind": "required",
        "name": "klevu_shopperIP",
        "type": "string",
        "description": "IP address of the shopper who viewed the category page.\n\n*If calling from javascript, this is an optional parameter."
      },
      {
        "kind": "optional",
        "name": "klevu_activeFilters",
        "type": "string",
        "children": [],
        "description": "This refers to the filters that were applied during the category page view event. The format for the applied filters is \"<filterKey1>:<filterValue1>;;<filterKey2>:<filterValue2>\". Multiple filters are separated by \";;\". For example, \"style:Underseat Luggage;;color:blue\"."
      },
      {
        "kind": "optional",
        "name": "klevu_abTestId",
        "type": "string",
        "children": [],
        "description": "The unique identifier of the A/B Test."
      },
      {
        "kind": "optional",
        "name": "klevu_abTestVariantId",
        "type": "string",
        "children": [],
        "description": "The unique identifier of the A/B Test Variant."
      },
      {
        "name": "klevu_shopperIP_v4",
        "kind": "optional",
        "type": "string",
        "description": "IPv4 address of the shopper who viewed a category page.",
        "children": []
      },
      {
        "name": "klevu_shopperIP_v6",
        "kind": "optional",
        "type": "string",
        "description": "IPv6 address of the shopper who viewed a category page.",
        "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 viewed a category. 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 viewed a category.",
        "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": "mMCwmnqgHyEFJv4j56P1h",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://stats.ksearchnet.com/analytics/categoryProductViewTracking?klevu_apiKey=klevu-1234567890&klevu_categoryName=tees&klevu_categoryPath=Mens%253BShoes%2520and%2520Trainers%253BSneakers&klevu_productIds=31366450446398,31366450380862,31366479020094,31366447038526,31366447923262,31366448382014&klevu_pageStartsFrom=0',\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": "php",
        "customLabel": ""
      },
      {
        "id": "bBzdFXkvvZ09pieoDzhwC",
        "code": "// WARNING: For GET requests, body is set to null by browsers.\n\nvar xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\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/categoryProductViewTracking?klevu_apiKey=klevu-1234567890&klevu_categoryName=tees&klevu_categoryPath=Mens%253BShoes%2520and%2520Trainers%253BSneakers&klevu_productIds=31366450446398%2C31366450380862%2C31366479020094%2C31366447038526%2C31366447923262%2C31366448382014&klevu_pageStartsFrom=0\");\n\nxhr.send();",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "3ikKepqX_FFNMIW40CzKP",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nRequest request = new Request.Builder()\n  .url(\"https://stats.ksearchnet.com/analytics/categoryProductViewTracking?klevu_apiKey=klevu-1234567890&klevu_categoryName=tees&klevu_categoryPath=Mens%3BShoes%20and%20Trainers%3BSneakers&klevu_productIds=31366450446398,31366450380862,31366479020094,31366447038526,31366447923262,31366448382014&klevu_pageStartsFrom=0\")\n  .method(\"GET\", null)\n  .build();\nResponse response = client.newCall(request).execute();",
        "language": "java",
        "customLabel": ""
      },
      {
        "id": "C6uOme2HcXhNgZOFPqfkD",
        "code": "var request = require('request');\nvar options = {\n  'method': 'GET',\n  'url': 'https://stats.ksearchnet.com/analytics/categoryProductViewTracking?klevu_apiKey=klevu-1234567890&klevu_categoryName=tees&klevu_categoryPath=Mens%3BShoes%20and%20Trainers%3BSneakers&klevu_productIds=31366450446398,31366450380862,31366479020094,31366447038526,31366447923262,31366448382014&klevu_pageStartsFrom=0',\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": ""
      }
    ],
    "selectedLanguageId": "bBzdFXkvvZ09pieoDzhwC"
  },
  "description": "Use this API endpoint to submit category page views activity:\n1.  When the category response is received\n2. And also when a facet is clicked (triggering a follow up query) \n\n",
  "currentNewParameter": {
    "label": "Query Parameter",
    "value": "queryParameters"
  },
  "autoGeneratedAnchorSlug": "reporting-category-page-views",
  "legacyHash": "xXwY19SNxXJHv638AIMn_"
}
```
:::



:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://{{ Analytics_URL }}/analytics/categoryProductClickTracking",
  "name": "Reporting Category Product Clicks",
  "method": "GET",
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "kind": "required",
        "name": "klevu_apiKey",
        "type": "string",
        "description": "This is your Klevu JS API Key."
      },
      {
        "kind": "required",
        "name": "klevu_categoryName",
        "type": "string",
        "description": "This is the name of the category being visited. For example, Stackable Rings. The name should not include parent categories."
      },
      {
        "kind": "required",
        "name": "klevu_categoryPath",
        "type": "string",
        "description": "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."
      },
      {
        "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": "optional",
        "name": "klevu_productName",
        "type": "string",
        "description": "Name of the product that was clicked."
      },
      {
        "kind": "optional",
        "name": "klevu_productUrl",
        "type": "string",
        "description": "URL of the product that was clicked."
      },
      {
        "kind": "optional",
        "name": "klevu_productSku",
        "type": "string",
        "description": "SKU code of the product that was clicked."
      },
      {
        "kind": "optional",
        "name": "klevu_salePrice",
        "type": "string",
        "description": "Decimal sale price of the product that was clicked."
      },
      {
        "kind": "optional",
        "name": "klevu_productRatings",
        "type": "Number",
        "description": "A decimal rating value between 0 and 5 of the product that was clicked."
      },
      {
        "kind": "optional",
        "name": "klevu_productPosition",
        "type": "Integer",
        "description": "Position of the product on the category page when it was clicked. For example, the value would be 0 if it is the first product on the first page. The value will be 30, if it is the first product on the 2nd page with 30 products being displayed per page."
      },
      {
        "kind": "required",
        "name": "klevu_shopperIP",
        "type": "string",
        "description": "IP address of the shopper who clicked the product(s).\n\n*If calling from javascript, this is an optional parameter."
      },
      {
        "kind": "optional",
        "name": "klevu_activeFilters",
        "type": "string",
        "children": [],
        "description": "This refers to the filters that were applied during the product clicked event. The format for the applied filters is \"<filterKey1>:<filterValue1>;;<filterKey2>:<filterValue2>\". Multiple filters are separated by \";;\". For example, \"style:Underseat Luggage;;color:blue\"."
      },
      {
        "kind": "optional",
        "name": "klevu_abTestId",
        "type": "string",
        "description": "The unique identifier of the A/B Test."
      },
      {
        "kind": "optional",
        "name": "klevu_abTestVariantId",
        "type": "string",
        "description": "The unique identifier of the A/B Test Variant.\n"
      },
      {
        "name": "klevu_shopperIP_v4",
        "kind": "optional",
        "type": "string",
        "description": "IPv4 address of the shopper who clicked a product.",
        "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": "mMCwmnqgHyEFJv4j56P1h",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://stats.ksearchnet.com/analytics/categoryProductClickTracking?klevu_apiKey=klevu-1234567890&klevu_categoryName=Sneakers&klevu_categoryPath=Mens%253BShoes%2520and%2520Trainers%253BSneakers&klevu_productId=54321-12345&klevu_productGroupId=54321&klevu_productVariantId=12345&klevu_productName=Smart%2520Trainers&klevu_productUrl=https%253A%252F%252Fyour.website.com%252Fproduct-url&klevu_productSku=ABC-123&klevu_salePrice=123.45&klevu_productRatings=3&klevu_productPosition=7&klevu_abTestId=9c8bm3o1-osjgoqn9-9mbjudid&klevu_abTestVariantId=if92kdmc-98ckcj89-98cjcd9d',\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": "php",
        "customLabel": ""
      },
      {
        "id": "bBzdFXkvvZ09pieoDzhwC",
        "code": "\nvar 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/categoryProductViewTracking?klevu_apiKey=klevu-1234567890&klevu_categoryName=tees&klevu_categoryPath=Mens%253BShoes%2520and%2520Trainers%253BSneakers&klevu_productIds=31366450446398,31366450380862,31366479020094,31366447038526,31366447923262,31366448382014&klevu_pageStartsFrom=0');\n\nxhr.send();",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "3ikKepqX_FFNMIW40CzKP",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nRequest request = new Request.Builder()\n  .url(\"https://stats.ksearchnet.com/analytics/categoryProductClickTracking?klevu_apiKey=klevu-1234567890&klevu_categoryName=Sneakers&klevu_categoryPath=Mens%3BShoes%20and%20Trainers%3BSneakers&klevu_productId=54321-12345&klevu_productGroupId=54321&klevu_productVariantId=12345&klevu_productName=Smart%20Trainers&klevu_productUrl=https%3A%2F%2Fyour.website.com%2Fproduct-url&klevu_productSku=ABC-123&klevu_salePrice=123.45&klevu_productRatings=3&klevu_productPosition=7&klevu_abTestId=9c8bm3o1-osjgoqn9-9mbjudid&klevu_abTestVariantId=if92kdmc-98ckcj89-98cjcd9d\")\n  .method(\"GET\", null)\n  .build();\nResponse response = client.newCall(request).execute();",
        "language": "java",
        "customLabel": ""
      },
      {
        "id": "C6uOme2HcXhNgZOFPqfkD",
        "code": "var request = require('request');\nvar options = {\n  'method': 'GET',\n  'url': 'https://stats.ksearchnet.com/analytics/categoryProductClickTracking?klevu_apiKey=klevu-1234567890&klevu_categoryName=Sneakers&klevu_categoryPath=Mens%3BShoes%20and%20Trainers%3BSneakers&klevu_productId=54321-12345&klevu_productGroupId=54321&klevu_productVariantId=12345&klevu_productName=Smart%20Trainers&klevu_productUrl=https%3A%2F%2Fyour.website.com%2Fproduct-url&klevu_productSku=ABC-123&klevu_salePrice=123.45&klevu_productRatings=3&klevu_productPosition=7&klevu_abTestId=9c8bm3o1-osjgoqn9-9mbjudid&klevu_abTestVariantId=if92kdmc-98ckcj89-98cjcd9d',\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": ""
      }
    ],
    "selectedLanguageId": "bBzdFXkvvZ09pieoDzhwC"
  },
  "description": "Use this API endpoint to submit the product clicks from category page results.\n",
  "currentNewParameter": {
    "label": "Query Parameter",
    "value": "queryParameters"
  },
  "autoGeneratedAnchorSlug": "reporting-category-product-clicks",
  "legacyHash": "p_x2ERCBm5K1bEb9qwgzG"
}
```
:::



:::ApiMethodV2
```json
{
  "tab": "examples",
  "url": "https://config-cdn.ksearchnet.com/abtest/public/usage/{{ Your Klevu apiKey }}/",
  "name": "Reporting A/B Test Variant View",
  "method": "POST",
  "request": {
    "pathParameters": [],
    "queryParameters": [
      {
        "kind": "required",
        "name": "sourceId",
        "type": "string",
        "description": "The unique identifier of the element to which the A/B Test ID and Variant are assigned to. In this case, it will be a Category name."
      },
      {
        "kind": "required",
        "name": "abTestId",
        "type": "string",
        "description": "The unique identifier of the A/B Test."
      },
      {
        "kind": "required",
        "name": "abTestVariantId",
        "type": "string",
        "description": "The unique identifier of the A/B Test Variant."
      },
      {
        "kind": "required",
        "name": "type",
        "type": "string",
        "description": "The type of element to which an A/B Test will be assigned. For now, will be “CAT_NAV”."
      }
    ],
    "headerParameters": [],
    "bodyDataParameters": [],
    "formDataParameters": []
  },
  "results": {
    "languages": [
      {
        "id": "DdxomvWNISlr_Jx48gHQd",
        "code": "",
        "language": "200",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "DdxomvWNISlr_Jx48gHQd"
  },
  "examples": {
    "languages": [
      {
        "id": "nUESRs-n5VrHA1aB9gv6Y",
        "code": "{\n    \"sourceId\": \"womens;jeans\",\n    \"abTestId\": \"9c8bm3o1-osjgoqn9-9mbjudid\",\n    \"abTestVariantId\": \"if92kdmc-98ckcj89-98cjcd9d\", \n    \"type\": \"CAT_NAV\"\n}",
        "language": "json",
        "customLabel": ""
      },
      {
        "id": "mMCwmnqgHyEFJv4j56P1h",
        "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://config-cdn.ksearchnet.com/abtest/public/usage/klevu-158755634955912036/',\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 => 'POST',\n  CURLOPT_POSTFIELDS =>'{\n    \"sourceId\": \"womens;jeans\",\n    \"abTestId\": \"9c8bm3o1-osjgoqn9-9mbjudid\",\n    \"abTestVariantId\": \"if92kdmc-98ckcj89-98cjcd9d\", \n    \"type\": \"CAT_NAV\"\n}',\n  CURLOPT_HTTPHEADER => array(\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n",
        "language": "php",
        "customLabel": ""
      },
      {
        "id": "bBzdFXkvvZ09pieoDzhwC",
        "code": "var data = JSON.stringify({\"sourceId\":\"womens;jeans\",\"abTestId\":\"9c8bm3o1-osjgoqn9-9mbjudid\",\"abTestVariantId\":\"if92kdmc-98ckcj89-98cjcd9d\",\"type\":\"CAT_NAV\"});\n\nvar 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(\"POST\", \"https://config-cdn.ksearchnet.com/abtest/public/usage/klevu-158755634955912036/\");\nxhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\nxhr.send(data);",
        "language": "javascript",
        "customLabel": ""
      },
      {
        "id": "3ikKepqX_FFNMIW40CzKP",
        "code": "OkHttpClient client = new OkHttpClient().newBuilder()\n  .build();\nMediaType mediaType = MediaType.parse(\"application/json\");\nRequestBody body = RequestBody.create(mediaType, \"{\\n    \\\"sourceId\\\": \\\"womens;jeans\\\",\\n    \\\"abTestId\\\": \\\"9c8bm3o1-osjgoqn9-9mbjudid\\\",\\n    \\\"abTestVariantId\\\": \\\"if92kdmc-98ckcj89-98cjcd9d\\\", \\n    \\\"type\\\": \\\"CAT_NAV\\\"\\n}\");\nRequest request = new Request.Builder()\n  .url(\"https://config-cdn.ksearchnet.com/abtest/public/usage/klevu-158755634955912036/\")\n  .method(\"POST\", body)\n  .addHeader(\"Content-Type\", \"application/json\")\n  .build();\nResponse response = client.newCall(request).execute();",
        "language": "java",
        "customLabel": ""
      },
      {
        "id": "C6uOme2HcXhNgZOFPqfkD",
        "code": "var request = require('request');\nvar options = {\n  'method': 'POST',\n  'url': 'https://config-cdn.ksearchnet.com/abtest/public/usage/klevu-158755634955912036/',\n  'headers': {\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({\"sourceId\":\"womens;jeans\",\"abTestId\":\"9c8bm3o1-osjgoqn9-9mbjudid\",\"abTestVariantId\":\"if92kdmc-98ckcj89-98cjcd9d\",\"type\":\"CAT_NAV\"})\n\n};\nrequest(options, function (error, response) {\n  if (error) throw new Error(error);\n  console.log(response.body);\n});\n",
        "language": "nodejs",
        "customLabel": ""
      }
    ],
    "selectedLanguageId": "bBzdFXkvvZ09pieoDzhwC"
  },
  "description": "Use this API endpoint to report which A/B test variant is viewed.\n\n",
  "currentNewParameter": {
    "label": "Query Parameter",
    "value": "queryParameters"
  },
  "autoGeneratedAnchorSlug": "reporting-ab-test-variant-view",
  "legacyHash": "KJknw4xTbARU8YaCcLfrt"
}
```
:::

