Versioning
The core Klevu JS Library is provided on the following URL
Note the V2 path will always track the latest 2.x version and be the most up-to-date.
If you prefer to lock to a specific version, you can optionally indicate the specific version within the path.
e.g.
If you opt to lock to a specific version, you will need to manually update your version from time to time to get the latest Klevu features and bug fixes.
The Klevu Theme follows the same versioning process as the core Klevu JS Library
Quick Search:
Search Results Landing Page:
Category/Collection Landing Pages:
Recommendations Widgets/Banners:
The following .tpl files are automatically pulled into the corresponding theme javascript during injection. They are listed here to be used as a non-minified reference.
Note: When viewing these in the browser, use view-source to see the templates raw markup
Quick Search:
Search Results Landing Page:
Category/Collection Landing Pages:
During your development you may find it easier to reference non-minified versions of the script libraries.
You can access the non-minified version of any core file by adding debug to the filename.
e.g.
If you are using Google Pagespeed Insights or Lighthouse, you might find some Klevu scripts labeld as render-blocking. Klevu provides the option to lazy-load our theme scripts which will improve your lighthouse performance score, but there is more to consider.
With lazy-load enabled, the initial script sizes are tiny. These scripts then request more resources when required, which can slightly slow the display of products compared to when lazy-load is disabled, especially after the first-page load when none of the lazy-loaded scripts are cached.
We have included lazy-load file options so you may try both settings and determine which works best for your site.
You can access the lazy-load version of the following files by adding lazyload to the filename reference.
e.g.
It is not possible to have the https://js.klevu.com/core/v2/klevu.js to be lazyload.
It contains the main Klevu JS object which is used by other Klevu scripts to render the results. There is potential for conflicts with onpage objects expecting the Klevu core to be in place.
Magento users can find lazy-load selection options within the Magento Klevu admin interface.
Magento admin > Stores > Configuration > Klevu > Search Configuration > Developer Settings
See : The knowledgebase guide for Magento lazy-loading for more details.
It is very common to load the Quick Search script along with the Search Result Landing Page script or the Category/Collection Landing Page script because the Quick Search is typically available on every page of your site. Because there is some shared code within the Quick Search script and the other two scripts, Klevu also provides combined scripts that reduce the amount of JavaScript by 42% when using the combined scripts on either the Search or Category/Collection pages.
So for example, instead of loading the Quick Search + Search Result Landing Page scripts separately on the Search page, you could load the combined script instead and reduce the download size as well as reduce the execution time of the code within the combined script on that page. The same is true on the Category/Collection Landing Pages.
There is no benefit when loading any other pages besides Search or Category/Collection since the script for Quick Search has not changed.
It is not possible to load these scripts with the automated integration available in the platform specific Klevu apps, so using these scripts requires a manual integration of the Template JS library in your site.
You can follow the Combined Scripts guide to see examples of how to integrate these combined scripts with Shopify or BigCommerce.