Lightspeed Installation Guide
Inserting the Hello Retail script + cart tracking
Log in to your lightspeed back office and navigate to Settings > Web extras
Insert the script in the "CUSTOM JS" section:
The script should be:
<script async src="https://helloretailcdn.com/helloretail.js"></script> <script> window.hrq = window.hrq || []; hrq.push(['init', {}]); hrq.push(function(sdk) { try { var base_url = window.location.origin + "/"; if (window.location.pathname.startsWith("/" + document.documentElement.lang +"/")){ base_url += document.documentElement.lang + "/"; } fetch(base_url + 'cart?format=json') .then((response) => response.json()) .then((data) => { var product_urls = []; var product_numbers = []; var cart_total = 0; var cart = data.cart; if (cart) { cart.products.forEach(function(product){ product_urls.push(base_url + product.url); product_numbers.push(product.id); }); cart_total = parseFloat(cart.totals.grand_total); } sdk.setCart({ total: cart_total, url: window.location.origin + '/cart', urls: product_urls, productNumbers: product_numbers }); }); } catch(e) { console.log("Could not set cart", e); } }); </script>
Inserting the Hello Retail conversion tracking
While still in the Settings > Web extras, Insert the conversion tracking in the "TRACKING" section.
The conversion tracking script should be
<script> hrq = window.hrq || []; hrq.push(function(sdk) { var product_numbers = []; {% for product in order.products %} product_numbers.push('{{ product.product_id }}'); {% endfor %} sdk.trackConversion({ total: {{ order.information.price_incl }}, orderNumber: '{{ order.information.number }}', email: '{{ order.customer.email }}', productNumbers: product_numbers }); }); </script>
Remember to save your changes
Make your data available to Hello Retail
Our new API based feeds for products, categories and orders are easy to get up and running - all you need is to get an API key + API secret from your Lightspeed representative.
If you are a new customer you will be prompted to insert the API credentials in the onboarding flow when creating your webshop:
To get the API credentials, navigate to the Settings > Store Settings > Developers section in your Lightspeed Dashboard:
Click New API Key and name it something logical like "Hello Retail API" for example:
After naming the API and pressing Save, you'll be brought to the following page where you'll need to check-off "read" access to "Content", "Products", and "Orders". Click Enable and Save, then copy the API Key and API Secret and paste them into the Hello Retail Dashboard as shown in the first image above in this section.
For the Language section, please write the two-letter country abbreviation. An example of this would be the following:
- Dutch --> NL
- French --> FR
- Spanish --> ES
- German --> DE
- English (UK) --> EN
- English (US) --> US
For Cluster, EU customers should write eu1. US customers, please write us1.
Configure Webshop
After the installation setup of your platform and the onboarding flow, make sure to have your webshop configured. Read this guide here on how to do so: