<script src="https://web-resources.offer18.net/sdk/web/WebSDK.js"></script>
<script>
var my_order_id = {{{ checkout.order.id }}};
let my_store_api = '/api/storefront/orders/' + my_order_id;
fetch(my_store_api)
.then((res) => res.json())
.then((order) => {
var couponString = '';
if (order.coupons) {
couponString = order.coupons
.map(c => c.code)
.join(', ');
}
window.Offer18WebSDK.trackConversion({
domain: '<YOUR-POSTBACK-DOMAIN>',
accountId: '<YOUR-ACCOUNT-ID>',
offerId: '<CAMPAIGN-ID>',
coupon: `${couponString}`,
postbackType: '', // 'iframe' or 'pixel'
isGlobalPixel: false, // true or false
allowMultiConversion: false, // true or false
conversionData: {
sale: `${order.orderAmount}`, // Sale Amount
currency: `${order.currency.code}`,
adv_sub5: `${my_order_id}`,
}
});
});
</script>