Lightspeed Installation Guide

Lightspeed Installation Guide

Inserting the Hello Retail script + cart tracking

Log in to your lightspeed backoffice and navigate to SettingsWeb extras

Insert the script in the "CUSTOM JS" section:

The script should be

<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 {
        ADDWISH_PARTNER_NS.$.get((window.location.origin + '/cart?format=json'), function(data){
            var product_urls = [];
            var cart_total = 0;
            var cart = data.cart;
            if (cart) {
                ADDWISH_PARTNER_NS.$.each(cart.products, function(index, product){
                    product_urls.push(window.location.origin + '/' + product.url);
                });
                cart_total = parseFloat(cart.totals.grand_total);
            }
            ADDWISH_PARTNER_NS.api.cart.setCart({
                total: cart_total,
                url: window.location.origin + '/cart',
                urls: product_urls
            });
        });
    } catch(e) {
        ADDWISH_PARTNER_NS.log("Could not set cart", e);
    }
}]);
</script>

Important: Once you have pasted it you should replace YOUR_PARTNER_ID with your own Hello Retail id. You can find this by logging into your account. 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.sku }}');
    {% 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:

 

However If you are an existing customer you will have to give these to our customer support department.

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 Ligthspeed.

Like
  • 3 mths agoLast active
  • 222Views
  • 1 Following