JavaScript Integration Guide
Uniqodo’s frontend integration is made up of two JavaScript tags that work together to validate and redeem promotional codes. These tags need to be added to the retailer’s website.
The purpose of each tag is described in the table below:
Tag | Purpose |
Tag 1 (Visit) | To track customers visiting the site who have come from a distributor with a code, so that performance can be measured and codes auto-filled as part of the checkout process |
Tag 2 (Redemption) | To track a successful order through Uniqodo and, if necessary, to expire the issued code following its redemption |
The visit and redemption tags should only be fired once on initial page load, this includes Single Page Applications (SPA).
Tag 1 - (Visit)
The following script tag - Tag 1 (Visit) - should be added to every page on the website before the closing HTML </body> tag, except on pages where Tag 2 (Redemption) is present.
Tag 1 allows Uniqodo to track codes that were attained through a distributor, and allows Uniqodo to configure, control and validate codes entered in the code entry fields.
<script type="text/javascript" async="" src="https://www.uqd.io/YOUR_UNIQODO_ID_HERE.js"></script>
Tag 2 - (Redemption)
The following script tag - Tag 2 (Redemption) - should be added to every transaction confirmation page and set to display whenever a transaction is completed. It should be added just before the closing HTML </body.> tag.
Tag 2 (Redemption) is used to record the occurrence of a successful transaction. It is also for determining whether a given code needs to be expired following its redemption, which depends on the usage limit arranged for that code. When the given code is valid for one use only, the tag immediately expires the code following a redemption. When the given code is valid for more than one use, the tag tallies each redemption against the usage limit, only expiring the code once the limit is reached.
Various pieces of information are required to enable this code to function, see the table below for more information on what values are required and how to integrate them.
<script type="text/javascript">
UNIQODO = typeof UNIQODO !== "undefined" ? UNIQODO : {};
UNIQODO.orderConfirmation = true;
UNIQODO.orderId = "ORDER_ID_HERE";
UNIQODO.orderValue = "ORDER_VALUE_HERE";
UNIQODO.discount = "DISCOUNT_AMOUNT_HERE";
UNIQODO.delivery = "DELIVERY_HERE";
UNIQODO.triggerCode = "TRIGGER_CODE_HERE";
UNIQODO.currency = "CURRENCY_HERE";
UNIQODO.cg = "COMMISSION_GROUP_DATA_HERE";
// additional merchant custom data if required
UNIQODO.p1 = "customData1";
UNIQODO.p2 = "customData2";
UNIQODO.p3 = "customData3";
UNIQODO.p4 = "customData4";
UNIQODO.p5 = "customData5";
</script>
<script type="text/javascript" async="" src="https://www.uqd.io/YOUR_UNIQODO_ID_HERE.js"></script>
The section - "YOUR_UNIQODO_ID_HERE" - should be replaced with your Uniqodo account ID. This value will be supplied in an email but is also available on the “Setup” page in your Uniqodo account.
E.g. if your Uniqodo ID is 1234 then the tag URL should be:
<script type="text/javascript" async="" src="https://www.uqd.io/1234.js"></script>
The table below details the parameters for Tag 2 (Redemption):
Parameter | Description | Usage | Format | Example Value |
UNIQODO.orderId | The unique ID of the order or booking in the retailer’s system | Required | String | ABC123456 |
UNIQODO.orderValue | The total value of the order prior to any discount and excluding delivery costs. If the transaction is a lead type the value should be set to 0.00 | Required | Float | 1234.56 |
UNIQODO.discount | The discount value that the customer received for the order. Set this to an empty string if no discount is available | Required | Float | 25.50 |
UNIQODO.delivery | The delivery or shipping charge the customer has paid on the order. If there is no delivery charge for the transaction it should be set to 0.00 or left blank | Optional | Text | 3.99 |
UNIQODO.triggerCode | The discount code associated with the transaction coming from the advertiser’s eCommerce platform. If this value is not available then it can be set to | Required | String | SUMMER10 |
UNIQODO.currency | The three digit ISO 4217 currency code for the transaction currency | Required | ISO 4217 code | GBP |
UNIQODO.cg | Commission group value. This is required for Awin advertisers and it should hold exactly the same value as the | Optional | Text | ABC123456 |
UNIQODO.p1 | A custom value the retailer can add for reporting and data segmentation | Optional | Text | Social |
UNIQODO.p2 | A custom value the retailer can add for reporting and data segmentation | Optional | Text | Affiliate Network 1 |
UNIQODO.p3 | A custom value the retailer can add for reporting and data segmentation | Optional | Text | Email Campaign 1 |
UNIQODO.p4 | A custom value the retailer can add for reporting and data segmentation | Optional | Text | Affiliate 12345 |
UNIQODO.p5 | A custom value the retailer can add for reporting and data segmentation | Optional | Text | Email Campaign 2 |