Build UI
Templates Customizations
Analytics/Tracking
14min
klevu template js already includes the majority of analytics requirements out of the box if you are modifying the templates in any way, it is still important to understand the contents of this page, and validate your integration against the requirements below it is one of the key drivers behind klevu machine learning; tracking customer searches and clicks to feed into our ai for relevant search results based on real customer interactions analytics collection is required for all integrations and should not be considered an optional element this page covers the minimum requirements for klevu analytics you may also decide that other interactions such as product views or interactions elsewhere in your website constitute a ‘click’, so you could also submit those if you choose template js analytics event listeners are not responsible for order/checkout/purchase data this call must be implemented during your platform checkout processing see purchases/ orders placed section below analytics events if you elect to not use klevu's built in analytics collection events, the sections below can assist in setting up a system that fits your architecture the best the following is a list of tracking events that are required in any klevu implementation searched terms products clicked orders placed these events must be tracked in all areas of your store which contain a klevu implementation, including quick search search results landing page category pages using klevu smart category navigation landing pages built with klevu landing page builder searched terms when the customer enters a search query, either via quick search or when reaching your search results landing page, it is important to inform klevu of this activity this is detailed in the klevu api documentation and looks like this https //stats ksearchnet com/analytics/n search/search ?apikey=klevu 1234567890 \&term=red%20shoes \&klevu totalresults=35 \&klevu typeofquery=wildcard and products clicked (search) once a customer has used quick search, viewed a search results page or landed on a klevu powered landing page, it is important to capture any product interactions they go on to make this is detailed in the klevu api documentation https //docs klevu com/apis/smart search analytics events and looks like this https //stats ksearchnet com/analytics/producttracking ?klevu apikey=klevu 1234567890 \&klevu keywords=red%20shoe \&klevu type=clicked \&klevu productid=54321 12345 \&klevu productname=smart%20trainers \&klevu producturl=https%3a%2f%2fyour website com%2fproduct url products clicked (category) once a customer has viewed a category page powered by klevu smart category navigation, it is important to capture any product interactions they go on to make this is detailed in the klevu api documentation https //docs klevu com/apis/smart search analytics events and looks like this 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 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 purchases/orders placed the final analytics data required is when a customer makes a purchase if you are using the klevu plugin for magento, shopify or bigcommerce, the order tracking analytics is already taken care of for you via a server side implementation important please do not add a frontend implementation if you are using one of the these plugins, as this would result in duplicate analytics requests if you are not using one of our plugins then you have two options for sending the transaction analytics data to klevu a server side implementation via a scheduled task via a frontend implementation, eg on the checkout success page the api call is the same for each approach, and is detailed in the klevu api documentation https //docs klevu com/apis/smart search analytics events it is up to you which you choose, but please only choose one the analytics request looks like this https //stats ksearchnet com/analytics/producttracking ?klevu apikey=klevu 1234567890 \&klevu type=checkout \&klevu productid=54321 12345 \&klevu unit=2 \&klevu saleprice=123 45 \&klevu currency=gbp this api call must be made for each product purchased this tracking event is the same regardless of whether the customer used search or category navigation please submit all orders to klevu , even if the customer didn’t use search or visit a category page category page views when the customer visits a category page powered by klevu smart category navigation, it is important to inform klevu of this activity this is detailed in the klevu api documentation https //docs klevu com/apis/smart search analytics events and looks like this https //stats ksearchnet com/analytics/categoryproductviewtracking ?klevu apikey=klevu 1234567890 \&klevu categoryname=sneakers \&klevu categorypath=mens%3bshoes%20and%20trainers%3bsneakers \&klevu productids=54321 12345%2c345 \&klevu pagestartsfrom=0 no results found even if the customer types in a query that yields no results, you should still send the analytics tracking request to klevu the important element to inform klevu of a ‘no results found’ query is klevu totalresults=0 this applies to both quick search and the search results landing page https //stats ksearchnet com/analytics/n search/search ?apikey=klevu 1234567890 \&term=red%20shoes & klevu totalresults=0 \&klevu typeofquery=wildcard and analytics on modified templates if you are using a modified version of a klevu productblock template(s), be aware of the required class selectors for analytics tracking event listening (this is a common oversight when extensively modifying the template) quicksearch product \<li class=" klevuproduct trackproductclick kutrackrecentview " data id="<%=datalocal id%>" > searchresults product \<li class=" klevuproduct klevuproductclick kutrackrecentview " data id="<%=datalocal id%>" > other product link \<a class=" klevuproduct klevuproductclick kutrackrecentview " data id="<%=datalocal id%>" > recommendations templates \<li class= "kurecsitem kurecsitemclick" data id="<%= item id %>" > testing in order to know whether each of the tracking calls is working, you will get immediate feedback from the api response, which will look like this for successful requests \<data> \<response>success\</response> \</data> after a day or so you will start to see the analytics data appearing in the klevu merchant centre, as the analytics data you provide is not processed in realtime and instead handled in batches due to the various calculations involved