Coupon Codes
<script>
SP.go('thankYouPage', {
order: {
id: "ORDER_ID",
total: ORDER_TOTAL,
couponCode: "COUPON_CODE"
}
});
</script>Tell Trustisto which coupon code the customer used in the order. With the code Trustisto can:
- mark a one-time coupon sent by a Trustisto campaign as used, so it is not counted as available any more,
- credit the order to the campaign (Overlay, Bar or Mail) that sent the coupon, within the campaign’s conversion time, even when the customer bought on another device or without clicking the campaign,
- show the coupon in the client’s history and in the coupon set statistics.
Codes that were not issued by Trustisto are accepted too: they are saved with the order, but do not change any coupon or campaign statistics.
There are three ways to pass the code. Use the one that suits your checkout.
In the order
Pass couponCode in the order of the Thank You Page snippet. This is the most reliable way: the code comes from your shop, after the order is placed.
<script>
SP.go('thankYouPage', {
order: {
id: "ORDER_ID",
total: ORDER_TOTAL,
couponCode: "LATO20"
}
});
</script>With Save Client
When the code is known earlier, e.g. on the basket page after the customer applies it, save it with Save Client:
<script>
SP.go('saveClient', { couponCode: "LATO20" });
</script>The code is kept in the browser and added to the order on the Thank You Page, when the order itself has no couponCode.
From the coupon field
When you can’t add code to your shop, but can add a script (e.g. in a tag manager), watch the coupon field with watchClient:
<script>
SP.go('watchClient', 'input[name="coupon"]', 'couponCode');
</script>Every time the customer types a code into the field, it is saved as with saveClient. Change the selector to match the coupon field in your checkout.
How the code is kept
couponCodeis stored only in the visitor’s browser. It is not saved in the client profile and is never sent with client updates.- The code is sent to Trustisto only with the order, on the Thank You Page.
- A
couponCodepassed in theorderalways wins over the saved one. - After the Thank You Page the saved code is removed, so it is not added to the next order.