Guide
Features
Analytics
5min
events can be sent to the analytics endpoint ( https //stats ksearchnet com/analytics/collect https //stats ksearchnet com/analytics/collect ) in order to record analytics data for use in conversion tracking using the analytics\collectservice data is sent as a collection of event objects (within an eventiterator) while multiple events can be sent in a single request, each individual event must be associated with a single event action (such as order purchase), klevu account, and user profile (eg, customer details) note only purchase events are currently available to send via the php sdk data contained within an event includes field description event the type of event / action to be tracked example "order purchase" apikey the js api (public) key for the klevu account receiving the data example "klevu 1234567890 version which version of the event format the transmitted data adheres to where backwards compatibility breaking changes (such as new mandatory fields) are introduced to this object, an incremented version will be available example 1 0 0 user profile object containing identifying information about the visitor performing the tracked action includes ipaddress email note this informational is optional, but without it conversion information may not be attributed correctly please ensure gdpr and other privacy concerns are accounted for before transmitting personally identifiable information data json object containing event data for recording content of this data will vary based on the event and/or version values of the object example see below event data for order purchase the data for events of type order purchase is an object with a single items key the data items property comprises an array of objects for each line item, with the following information field description order id string identifying the order to which this item belongs within the source system example "klevu12345" order line id string identifying the order line item within the source system example "12345" item name the name of the product purchased item id where a variant of a complex product has been purchased, this should be a combination of the group and variant ids; for simple products, use the product id examples "sku 12345" ; "prod 42 var 001" item group id string identifying the parent product within the source system, where the purchased item is a variant of a complex product leave empty or use the variant id where purchased product is not configurable examples "sku 12345" ; "prod 42" item variant id string identifying the purchased product variant within the source system example "sku 12345" ; "var 001" unit price decimal representation of the purchased price for the order line (ie, item price × quantity) without a currency code example 3 14 currency three character code for the currency in which the order was placed example "eur" units integer representation of the quantity purchased for this order line example 42 for more information, please see the storefront apis documentation sending data to older producttracking endpoints (eg https //stats ksearchnet com/analytics/producttracking https //stats ksearchnet com/analytics/producttracking ) is not supported in the php sdk validation and exception handling prior to transmitting data, each individual event is validated; any invalid records will throw a validationexception , preventing transmission of all events validation is performed on both the event properties, and the event data event data validation will differ depending on the event type and version request exceptions, or responses identifying an invalid request throw a badrequestexception client or network exceptions, responses with unexpected status codes, or responses with a missing or invalid body content throw a badresponseexception logging request headers and body are logged prior to send at debug level response headers, body, and execution time are logged on successful request send at debug level more information and code samples can be found under send analytics events data