Lightspeed Installation Guide

Lightspeed Installation Guide

Inserting the Hello Retail script + cart tracking

Log in to your lightspeed back office and navigate to SettingsWeb extras

Insert the script in the "CUSTOM JS" section:

The script should be:

(Be aware, that you need to replace "YOUR_PARTNER_ID" with your own partner ID. See below the script)

<script type="text/javascript">
(function() {
    var aws = document.createElement('script');
    aws.type = 'text/javascript';
    if (typeof(aws.async) != "undefined") { aws.async = true; }
    aws.src = 'https://d1pna5l3xsntoj.cloudfront.net/scripts/company/awAddGift.js#YOUR_PARTNER_ID';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(aws, s);
})();

_awev=(window._awev||[]);_awev.push(["bind_once", "crawl_completed", function() {
    try {
        var base_url = window.location.origin + "/";
        if (window.location.pathname.startsWith("/" + document.documentElement.lang +"/")){
            base_url += document.documentElement.lang + "/";
        }
        ADDWISH_PARTNER_NS.$.get((base_url + 'cart?format=json'), function(data){
            var product_urls = [];
            var product_numbers = [];
            var cart_total = 0;
            var cart = data.cart;
            if (cart) {
                ADDWISH_PARTNER_NS.$.each(cart.products, function(index, product){
                    product_urls.push(base_url + product.url);
                    product_numbers.push(product.id);
                });
                cart_total = parseFloat(cart.totals.grand_total);
            }
            ADDWISH_PARTNER_NS.api.cart.setCart({
                total: cart_total,
                url: window.location.origin + '/cart',
                urls: product_urls,
                productNumbers: product_numbers
            });
        });
    } catch(e) {
        ADDWISH_PARTNER_NS.log("Could not set cart", e);
    }
}]);
</script>



Important: Once you have pasted it you must replace YOUR_PARTNER_ID with your own Hello Retail id. You can find this by logging into your account — see more here. You should also enable the custom JavaScript using the status toggle.

Inserting the Hello Retail conversion tracking

While still in the SettingsWeb extras, Insert the conversion tracking in the "TRACKING" section.

The conversion tracking script should be

<script>
_awev=(window._awev||[]);_awev.push(["bind_once", "crawl_completed", function() {
    var product_numbers = [];
    {% for product in order.products %}
        product_numbers.push('{{ product.product_id }}');
    {% endfor %}
    ADDWISH_PARTNER_NS.api.conversion.track_sale({
        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 seen above.

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.

 

Notice: API access is not possible if you are on the cheapest Lightspeed package - If this is the case then you need to contact your sales representative at Lightspeed.

Like
  • 1 mth agoLast active
  • 730Views
  • 1 Following