Trending Products

Our legacy JS implementation included functionality to display some trending products when first clicking on the search box. This is still possible with a Klevu JS Library implementation, however it requires you to implement the logic and the corresponding API calls.

Global Trending Products (via JS)

For a brand new customer visiting the store, you can optionally pull the products which other customers are generally interacting with from our legacy static JS file which is periodically updated, available via{JS_API_KEY}.js, for example:

The popular products can be found within klevu_popularProductsOfSite.

Global Trending Products (via API)

Alternatively, you can make an API request to get the trending products, by searching for * (all products) and limiting the query size to the number of products you are interested in, then sorting the results by relevance. Thanks to the Klevu AI learning, this will return you the most popular products from the entire store.

Customer-specific Trending Products (via API)

Once a customer has interacted with some products on your website, you might choose to make these trending products more personalised on a 1-to-1 basis.

When a customer clicks, views or any otherwise interacts with a product, if you store the ID of that product you can include the customers recent interactions in the same API request as above, but this time the Klevu AI will take the context of those products into account and provide relevant results specific to that customer.

You can see an example of rendering trending products in our example repository.