Analytics/Tracking
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
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.
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:
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 and looks like this:
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 and looks like this:
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. It is up to you which you choose, but please only choose one. The analytics request looks like this:
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.
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 and looks like this:
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.
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).
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:
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.