Analytics

Analytics is extremely important in Klevu Search. It is required for all integrations and should not be considered an optional element.

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.

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.

You can find example implementations of the required analytics requests by searching within our examples repository for ‘klevu.analytics’.

Analytics Events

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 our 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

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.

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 our API Documentation 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

Products Clicked from 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 our API Documentation 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 from Category Pages

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 our API Documentation 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

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. Please do not add a frontend implementation if you are using one of the above 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:

  1. A server-side implementation via a scheduled task.
  2. Via a frontend implementation, eg. on the checkout success page.

The API call is the same for each approach, and is detailed in our API Documentation. 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.

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.