Advertiser Tracking Guide/Standard Implementation

From Wiki

Jump to: navigation, search

[-] Advertiser Tracking Guide

[-] Standard Implementation

[-] Journey Tag / MasterTag

The Journey Tag, or MasterTag as we call it at Awin, is a JavaScript library containing all functions required for our tracking solution and should be unconditionally appended to every page on the site, including the confirmation page, but excluding any page that displays or processes payment information. This should be done as late as possible, for example by placing the HTML script element just above the closing body tag and declaring it as defer="defer".

One of the built-in functionalities is to create a first party tracking cookie on the advertiser's domain and the contents of this will be appended onto the target URL's request string by Awin utilising a parameter named awc, for example awc=1001_1403695822_a430d81e22c9e8687f423efcf024fbaa. It is therefore vital that you pass this parameter and value pair on if you are issuing a re-direct or in any other way manipulating the URL.


Template

http(s)://www.dwin1.com/{{advertiserId}}.js


  • {{advertiserId}} must be replaced by the applicable Awin advertiser programme ID. Consult your account contact or assigned integrator if in any doubt


Example #1 - HTML script element

<script defer="defer" src="https://www.dwin1.com/1001.js" type="text/javascript"></script>


Example #2 - JavaScript append

var awMastertag = document.createElement("script");
awMastertag.setAttribute("defer", "defer");
awMastertag.src = (location.protocol == "http:") ? "http" : "https" + "://www.dwin1.com/1001.js";
awMastertag.type = "text/javascript";
document.getElementsByTagName("body")[0].appendChild(awMastertag);


[-] 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. The MasterTag will then subsequently parse the information populated in the AWIN.Tracking.Sale object, generate a set of tracking requests, and send them to the AWIN system.

The declaration must be done before the MasterTag loads. In a scenario where AJAX (or similar) is being used to load the order confirmation, then refer to example #2 as a re-declaration of the parent AWIN object will break tracking!


Template

/*** Do not change ***/
var AWIN = {};
AWIN.Tracking = {};
AWIN.Tracking.Sale = {};
/*** Set your transaction parameters ***/
AWIN.Tracking.Sale.amount = "{{totalAmount}}";
AWIN.Tracking.Sale.channel = "{{channel}}";
AWIN.Tracking.Sale.orderRef = "{{orderReference}}";
AWIN.Tracking.Sale.parts = "DEFAULT:{{totalAmount}}";
AWIN.Tracking.Sale.currency = "{{currencyCode}}";
AWIN.Tracking.Sale.voucher = "{{voucherCode}}";
AWIN.Tracking.Sale.test = "{{isTest}}";


  • {{totalAmount}} must be replaced by the total transaction amount, in most cases excluding VAT (or other taxes), delivery and discounts. The value must be a float, no thousand separator is allowed and finally the decimal place has to be a standard dot character, for example: "1083.29"
    If the transaction type is a lead, then instead declare the number of leads, for example: "1"
  • {{channel}} should be replaced with the name of the channel that is deemed as last click referrer. "aw" should always be utilised for Awin. Please refer to separate information about the Channel Parameter for more guidance
  • {{orderReference}} must be replaced by the unique booking / order reference
  • {{parts}} should be populated with alphanumerics and the accepted underscore character '_'
  • {{CurrencyCode}} If the site has multiple currencies then this parameter should populate with the currency code of the particular transaction, if customers can only transact in GBP, then hardcode in GBP.
  • {{VoucherCode}} If a voucher code is used in a transaction then this should populate within this parameter, if a voucher is not used the value should be left empty.
  • {{isTest}} should be populated with "0" when tracking is in live mode or alternatively "1" if in test mode. When set to the latter, the incoming tracking requests will not be processed


Example #1 - Declare conversion before MasterTag append

<script type="text/javascript">
/*** Do not change ***/
var AWIN = {};
AWIN.Tracking = {};
AWIN.Tracking.Sale = {};
/*** Set your transaction parameters ***/
AWIN.Tracking.Sale.amount = "8.33";
AWIN.Tracking.Sale.channel = "aw";
AWIN.Tracking.Sale.orderRef = "AA000001";
AWIN.Tracking.Sale.parts = "DEFAULT:8.33";
AWIN.Tracking.Sale.currency = "GBP";
AWIN.Tracking.Sale.voucher = "10OFF";
AWIN.Tracking.Sale.test = "0";
</script>


Example #2 - Trigger conversion after MasterTag append

if (typeof AWIN != "undefined" && typeof AWIN.Tracking != "undefined") {
    AWIN.Tracking.Sale = {};
    AWIN.Tracking.Sale.amount = parseFloat(fTotalAmount).toFixed(2);
    AWIN.Tracking.Sale.channel = sChannel;
    AWIN.Tracking.Sale.orderRef = sOrderReference;
    AWIN.Tracking.Sale.parts = "DEFAULT:" + parseFloat(fTotalAmount).toFixed(2);
    AWIN.Tracking.Sale.currency = sCurrency;
    AWIN.Tracking.Sale.voucher = sVoucherCode;
    AWIN.Tracking.Sale.test = "0";
    AWIN.Tracking.run();
}


Example Requests

If the Conversion Tag and the MasterTag have both been implemented correctly, then tracking requests similar to the below will be made:

https://www.awin1.com/sread.php?a=1001&b=8.33&cr=&c=AA000001&d=DEFAULT:8.33&vc=&t=0&ch=aw&cks=1001_1403695822_a430d81e22c9e8687f423efcf024fbaa&l=https%3A//advertiser-domain.com/confirmation.php&tv=2&tt=ia
https://www.awin1.com/sread.js?a=1001&b=8.33&cr=&c=AA000001&d=DEFAULT:8.33&vc=&t=0&ch=aw&cks=1001_1403695822_a430d81e22c9e8687f423efcf024fbaa&l=https%3A//advertiser-domain.com/confirmation.php&tv=2&tt=js
https://www.awin1.com/aw.swf?mid=1001&gv=1&l=https%3A//www.awin1.com/sread.php%3Fa%3D1001%26b%3D8.33%26cr%3D%26c%3DAA000001%26d%3DDEFAULT%3A8.33%26vc%3D%26t%3D0%26ch%3Daw%26l%3Dhttp%25253A//www.advertiser-domain.com/confirmation.php%26tv%3D2%26tt%3Dfc
https://www.awin1.com/sread.php?a=1001&b=8.33&cr=&c=AA000001&d=DEFAULT%3A8.33&vc=&t=0&cks=1001_1403695822_a430d81e22c9e8687f423efcf024fbaa&atp=&tv=2&tt=et&l=https%3A%2F%2Fwww.advertiser-domain.com%2Fconfirmation.php&ch=aw
https://www.awin1.com/alt.php?mid=1001&gv=1&a=1001&b=8.33&cr=&c=AA000001&d=DEFAULT:8.33&vc=&t=0&ch=aw&l=https%3A//www.advertiser-domain.com%2Fconfirmation.php
https://www.awin1.com/m/1001.gif


File:Information.png

Depending on your advertiser programme's set up, you could see tracking requests being directed towards our alternative tracking domain zenaps.com. The number of unique request types can vary from two to six.


[-] Fall-back Conversion Pixel

It is highly recommended to also display a Fall-back Conversion Pixel on conversion. This can be done via a HTML image element or by appending an image object to the DOM.


Template

http(s)://www.awin1.com/sread.img?tt=ns&tv=2&merchant={{advertiserId}}&amount={{totalAmount}}&ch={{channel}}&parts=DEFAULT:{{totalAmount}}&ref={{orderReference}}&cr={{currencyCode}}&vc={{VoucherCode}}&testmode={{isTest}}


  • {{advertiserId}} must be replaced by the applicable Awin advertiser programme ID. Consult your account contact or assigned integrator if in any doubt
  • {{totalAmount}} must be replaced by the total transaction amount, in most cases excluding VAT (or other taxes), delivery and discounts. The value must be a float, no thousand separator is allowed and finally the decimal place has to be a standard dot character, for example: "1083.29"
    If the transaction type is a lead, then instead declare the number of leads, for example: "1"
  • {{channel}} should be replaced with the name of the channel that is deemed as last click referrer. "aw" should always be utilised for Awin. Please refer to separate information about the Channel Parameter for more guidance
  • {{orderReference}} must be replaced by the unique booking / order reference
  • {{parts}} should be populated with alphanumerics and the accepted underscore character '_'
  • {{CurrencyCode}} If the site has multiple currencies then this parameter should populate with the currency code of the particular transaction, if customers can only transact in GBP, then hardcode in GBP.
  • {{VoucherCode}} If a voucher code is used in a transaction then this should populate within this parameter, if a voucher is not used the value should be left empty.
  • {{isTest}} should be populated with "0" when tracking is in live mode or alternatively "1" if in test mode. When set to the latter, the incoming tracking requests will not be processed


Example #1 - HTML image element

<img border="0" height="0" src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=1001&amount=8.33&ch=aw&parts=DEFAULT:8.33&ref=AA000001&cr=GBP&vc=10OFF&testmode=0" style="display: none;" width="0">


Example #2 - JavaScript image object

var sProtocol = (location.protocol == "http:") ? "http" : "https";
var awPixel = new Image(0, 0);
awPixel.src = sProtocol + "://www.awin1.com/sread.img?tt=ns&tv=2&merchant=1001&amount=" + parseFloat(fTotalAmount).toFixed(2) + "&ch=" + sChannel + "&parts=DEFAULT:" + parseFloat(fTotalAmount).toFixed(2) + "&ref=" + sOrderReference + "&vc=" + sVoucherCode + "&cr=" + sCurrencyCode + "&testmode=0";

Privacy

Due to new European legislation regarding how websites store information about you, AWIN is updating its privacy policy. You can see the new version of our policy here. If you would like to see the information we capture on this website, please click here for further details. In order to accept cookies on this site please click the 'I ACCEPT' button