Automatically track visitors, leads, and purchases on Lightspeed
LeadDyno offers a very simple integration with Lightspeed, making it incredibly easy to get an affiliate program going for your online Lightspeed shop.
In this article
Configuring your Lightspeed site
In the Lightspeed back office, please go to the Settings - Web Extras section.
Then, please add the snippet below in the Web Extras - Custom JS section and activate the section in question by switching the toggle from the "x" sign to the checkmark one.
<script>
(function() {
var first_js = document.getElementsByTagName('script')[0];
var js = document.createElement('script');
js.src = 'https://static.leaddyno.com/js';
js.type = "text/javascript";
js.async = true;
var _ld_init = function() {
LeadDyno.key = 'ADD YOUR LEADDYNO PUBLIC KEY HERE';
LeadDyno.recordVisit();
LeadDyno.autoWatch();
};
if (js.addEventListener) { // normal browsers
js.addEventListener('load', function() {
_ld_init();
}, false);
} else {
js.onreadystatechange = function() { // old IEs
if (js.readyState in {loaded: 1, complete: 1}) {
js.onreadystatechange = null;
_ld_init();
}
};
}
first_js.parentNode.insertBefore(js, first_js);
})();
</script>
The "ADD YOUR LEADDYNO PUBLIC KEY HERE" part will need to be replaced with your LeadDyno public key which can be found in the Account - Profile section of LeadDyno.
Afterward, please add the next snippet below to the Web Extras - Tracking section and activate the section in question by switching the toggle from the "x" sign to the checkmark one.
<script>
(function() {
if (addEventListener) {
addEventListener('load', function() {
LeadDyno.recordLead("{{ order.customer.email }}");
setTimeout(function() {
LeadDyno.recordPurchase("{{ order.customer.email }}", {
purchase_code: "{{ order.information.number }}",
code: "{{ order.information.code }}",
description: "lightspeed",
purchase_amount: parseFloat("{{ order.information.price_excl }}") - parseFloat("{{ order.shipment.price_excl }}"),
});
}, 500);
}, false);
} else {
onreadystatechange = function() {
if (readyState in {loaded: 1, complete: 1}) {
onreadystatechange = null;
LeadDyno.recordLead("{{ order.customer.email }}");
setTimeout(function() {
LeadDyno.recordPurchase("{{ order.customer.email }}", {
purchase_code: "{{ order.information.number }}",
code: "{{ order.information.code }}",
description: "lightspeed",
purchase_amount: parseFloat("{{ order.information.price_excl }}") - parseFloat("{{ order.shipment.price_excl }}"),
});
}, 500);
}
};
}
})();
</script>
At this point, your Lightspeed shop will be fully integrated with LeadDyno, which will track the source of all incoming leads, including affiliates and tracking campaigns.
Enabling AutoApprove (Optional)
Because the purchase information is coming from the LeadDyno javascript library, purchases must be approved before affiliate commissions are generated. If you find this a hassle and want to simply automatically approve purchases, you can enable “AutoApprove” of purchases by clicking the “AutoApprove” button from the Reporting - Purchases section:
Limitations / Known Issues
We recommend disabling express checkout options (such as Google Pay, ShopPay, AmazonPay) as the purchases made through express checkout will get tracked, but the affiliate referral most likely won't. This is due to the fact that the express checkout forms are hosted by iframe elements that can't be penetrated by Javascript, so the LeadDyno code can not interact with it and ensure that the lead is tracked when the purchase is made.