Quicker loading times
This documentation walks you through the steps for setting up nostojs client script on your theme with higher priority, which aims to loading Nosto faster.
Approach
Please follow the steps outlined below for setting up your theme:
Place the below content inside the
headsection oftheme.liquidfile, above the line that says{{ content_for_header }}.<script type="text/javascript"> (() => {window.nostojs=window.nostojs||(cb => {(window.nostojs.q=window.nostojs.q||[]).push(cb);});})(); </script> <script type="text/javascript"> nostojs(api => api.setAutoLoad(false)); </script>This accomplishes two results: i. Initializes
nostojsJavaScript api ii. Stops Nosto from loading recommendations by default\Place the following snippet, in the theme liquid template files that contains
nosto_elementelements, below all thenosto_elementsnippets:<script type="text/javascript">nostojs(api => api.loadRecommendations())</script>This line will make sure Nosto loads recommendations on after the
nosto_elementelements are loaded.
Last updated
Was this helpful?