LeadDyno offers a very simple integration with Wix, making it incredibly easy to get an affiliate program going for your online Wix store.
To use LeadDyno on Wix the following is required:
- Wix Stores
- Wix Premium Plan
- Connected Domain
In this article
Configuring Your Wix Store
In the Wix back office, please go to Settings → Advanced → Custom Code.
Then, choose the "Add Code" option in the Body-End section.
Please paste the snippet below in the "Paste the code snippet here:" section afterward and use any name you want.
<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';
setTimeout(function() {
LeadDyno.initWix();
}, 2000);
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.
Then, select the All Pages - Load code on each new page option and select to place the code in the Body-End section.
Finally, click on "Apply" and ensure that the newly added script is enabled.
To also enable the purchase tracking for your Wix store, please go to the Wix Editor and enable the Velo Dev Mode option.
After Velo Dev Mode is enabled, please go to the "Public&Backend" section. Then, click on the "+" sign next to the "Backend" area and choose "New .js file".
Name the new file "events.js" (NOTE: the file name has to be exactly events.js)
Then, add the snippet below to the events.js file to finish the tracking implementation.
import { fetch } from 'wix-fetch';
export async function wixStores_onOrderPaid(event) {
let headers = {
'Content-type': 'application/json',
'Key': 'ADD YOUR LEADDYNO PRIVATE KEY HERE'
};
let payload = {
channel: 'wix',
email: event.billingInfo.email,
purchase_code: event._id,
ld_ext: event._id,
purchase_amount: event.totals.total,
code: event.discount ? event.discount.appliedCoupon.code : null
};
await fetch("https://api.leaddyno.com/v1/purchases", {
method: 'POST',
headers: headers,
body: JSON.stringify(payload)
}).then(async (httpResponse) => {
let status = httpResponse.statusText;
console.log("status: ", status);
}).catch((error) => {
console.log('Oops...:' + error);
});
}
The "ADD YOUR LEADDYNO PRIVATE KEY HERE" part will need to be replaced with your LeadDyno private key which can be found in the Account - Profile section of LeadDyno.
At this point, your Wix store 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.