When to use the Nosto Javascript API
In most implementations there isn’t any need to use the Nosto Javascript API and the normal tagging implementation approach will work best and it’s the easiest to implement. Typically calling the API should be approached only after the normal tagging implementation has been done and now needs to be extended with something that doesn’t come out of the box.
The Javascript API is useful mostly in cases where the store is doing something dynamic and not reloading the page. For example showing recommendations in a product quick view, that opens the product in a css overlay via Ajax. Another case is when the whole store is implemented as a single page application.
Enabling Nosto Javascript API
To enable Nosto’s Javascript API, you have to use a recent enough version of Nosto’s embed script.
The easiest way to check that you are using a recent version enough, is to view your site’s html source and make sure it includes the text “nostojs.init”. In case that is there you are using the version that supports the Nosto Javascript API.
Another way to test that you have the Nosto Javascript API enabled is to call it through your browser’s Javascript console, for example pasting the following call and making sure your console then logs the message:
nostojs(function(api){ console.log('Hello through Nosto JS API'); });
API documentation
We’ve moved JS API documentation here.