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

https://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 = "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 || {};
AWIN.Tracking = 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 = "{{commissionGroupCode}}:{{totalAmount}}";
AWIN.Tracking.Sale.currency = "{{currencyCode}}";
AWIN.Tracking.Sale.voucher = "{{voucherCode}}";
AWIN.Tracking.Sale.test = "{{isTest}}";


  • {{totalAmount}} must be replaced by the order subtotal amount - after any relevant discounts are applied but prior to any additional fees such as taxes, delivery charges, or relevant service charges are added. 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"
  • {{commissionGroupCode}} should be replaced by the code for the commission group you want to attribute the transaction to. If no commission group is specified this should be set to Default. Accepted characters for the commissionGroup code are alphanumerics (letter in upper case), underscore '_' , point '.' and minus '-'
  • {{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
  • {{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. The parameter value has to be URL-encoded.
  • {{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 || {};
AWIN.Tracking = 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=GBP&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=GBP&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/sread.php?a=1001&b=8.33&cr=GBP&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=EUR&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 five.


[-] 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

https://www.awin1.com/sread.img?tt=ns&tv=2&merchant={{advertiserId}}&amount={{totalAmount}}&ch={{channel}}&parts={{commissionGroupCode}}:{{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 order subtotal amount - after any relevant discounts are applied but prior to any additional fees such as taxes, delivery charges, or relevant service charges are added. 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"
  • {{commissionGroupCode}} should be replaced by the code for the commission group you want to attribute the transaction to. If no commission group is specified this should be set to Default. Accepted characters for the commissionGroup code are alphanumerics (letter in upper case), underscore '_' , point '.' and minus '-'
  • {{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
  • {{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. The parameter value has to be URL-encoded.
  • {{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 awPixel = new Image(0, 0)
awPixel.src = "https://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