Awin Access Technical Integration Developer Guide (sale)
From Wiki
Contents |
Awin Access Tracking Implementation - Generic Developer Guide (sale)
If we do not support your eCommerce platform follow the below guide to implement the Awin tracking code.
Master Tag
The MasterTag is a JavaScript library containing all functions required for our tracking solution and should be unconditionally appended to every page on the site.
<!--Master Tag add just before the closing </body> tag--> <script src="https://www.dwin1.com/XXXXX.js" type="text/javascript" defer="defer"></script>
Replace XXXXX with your Advertiser ID (AID).
Log into the Awin UI, in the top right-hand corner of the screen you will find your AID.
Conversion Tag
The Conversion Tag, or Tracking Code as it also might be referred to, is the declaration of the AWIN.Tracking.Sale
JavaScript object, which is done on the confirmation page to instruct the MasterTag that a conversion has taken place. It will then subsequently perform the necessary tracking requests.
Place the following code onto the confirmation page (the page that appears after a customer makes a successful purchase).
<!—Image Pixel - Mandatory --> <img src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=XXXX&amount={{order_total}}&cr={{currency_code}}&ref={{order_ref}}&parts=DEFAULT:{{order_total}}&vc={{voucher_code}}&ch=aw&testmode=0" border="0" width="0" height="0"> <!-- JavaScript Tracking - Mandatory --> <script type="text/javascript"> //<![CDATA[ /*** Do not change ***/ var AWIN = AWIN || {}; AWIN.Tracking = AWIN.Tracking || {}; AWIN.Tracking.Sale = {}; /*** Set your transaction parameters ***/ AWIN.Tracking.Sale.amount = "{{order_total}}"; AWIN.Tracking.Sale.orderRef = "{{order_ref}}"; AWIN.Tracking.Sale.parts = "DEFAULT:{{order_total}}"; AWIN.Tracking.Sale.voucher = "{{voucher_code}}"; AWIN.Tracking.Sale.currency = "{{currency_code}}"; AWIN.Tracking.Sale.test = "0"; AWIN.Tracking.Sale.channel = "aw"; //]]> </script>
Replace XXXXX with your Advertiser ID.
The text in { brackets }
are placeholders – it will need to be replaced with the variables your site uses for the following information:
{{order_total}}
The total transaction amount set to two decimal places. Can include or exclude delivery/VAT charges.{{currency_code}}
To be populated with the ISO currency code of the currency that was used in the transaction.
Example: GBP
{{order_ref}}
A unique booking/order reference ID per order.{{voucher_code}}
The voucher code used in the transaction.
Example
For example, if a customer purchases a product for £5.99 using the Voucher Code ‘HALFPRICE’ the code should load as:
<!—Image Pixel - Mandatory --> <img src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=XXXX&amount=5.99&cr=GBP&ref=4-815162342&parts=DEFAULT:5.99&vc=HALFPRICE&ch=aw&testmode=0" border="0" width="0" height="0"> <!-- JavaScript Tracking - Mandatory --> <script type="text/javascript"> //<![CDATA[ /*** Do not change ***/ var AWIN = AWIN || {}; AWIN.Tracking = AWIN.Tracking || {}; AWIN.Tracking.Sale = {}; /*** Set your transaction parameters ***/ AWIN.Tracking.Sale.amount = "5.99"; AWIN.Tracking.Sale.orderRef = "4-815162342"; AWIN.Tracking.Sale.parts = "DEFAULT:5.99"; AWIN.Tracking.Sale.voucher = "HALFPRICE"; AWIN.Tracking.Sale.currency = "GBP"; AWIN.Tracking.Sale.test = "0"; AWIN.Tracking.Sale.channel = "aw"; //]]> </script>
You may wish to use PHP to load these variables (see example below). Alternatively, if you are using a third-party eCommerce platform, their support team may be able to provide you with the variables to use.
PHP example
<img border="0" height="0" src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=XXXX&amount=<?php echo $totalAmount; ?>&ch=aw&cr=<?php echo $currencyCode; ?>&parts=DEFAULT:<?php echo $totalAmount; ?>&ref=<?php echo $orderReference; ?>&testmode=0&vc=<?php echo $voucherCode; ?>" style="display: none;" width="0"> <script type="text/javascript"> //<![CDATA[ /*** Do not change ***/ var AWIN = AWIN || {}; AWIN.Tracking = AWIN.Tracking || {}; AWIN.Tracking.Sale = {}; /*** Set your transaction parameters ***/ AWIN.Tracking.Sale.amount = "<?php echo $totalAmount; ?>"; AWIN.Tracking.Sale.channel = "aw"; AWIN.Tracking.Sale.currency = "<?php echo $currencyCode; ?>"; AWIN.Tracking.Sale.orderRef = "<?php echo $orderReference; ?>"; AWIN.Tracking.Sale.parts = "DEFAULT:<?php echo $totalAmount; ?>"; AWIN.Tracking.Sale.test = "0"; AWIN.Tracking.Sale.voucher = "<?php echo $voucherCode; ?>"; //]]> </script>
Last Step - Tracking Tests
After integrating the Awin tracking you will need to create a test transaction via the Awin User Interface to check the tracking is working correctly.
Complete the steps to conduct a test transaction via our Test Transaction Guide
Need assistance integrating our tracking?
Do you require additional support or have a complex integration? We can provide technical integrations services - information on these services can be found here.