This guide is designed for advertisers looking to track leads. If you are a sale based Advertiser, see the developer sale guide.
Awin uses hybrid tracking technologies by default, meaning both client-side and server-side, including the various tracking code components, such as client-side conversion tag & conversion pixel as well as server-side request. We offer plugin solutions for some e-commerce online shop systems. We also recommend supporting cookie signals.
MasterTag
The MasterTag is a JavaScript library containing all functions required for our Tracking solutions and should be unconditionally appended to every page on the site.
Place the following code on every page of 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 platform, 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 loads after a customer makes a successful Lead).
<!—Image Pixel - Mandatory -->
<img src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=XXXXX&amount=1.00&cr=GBP&ref={{order_ref}}&parts=DEFAULT:1.00&vc=&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 = "1.00";
AWIN.Tracking.Sale.orderRef = "{{order_ref}}";
AWIN.Tracking.Sale.parts = "DEFAULT:1.00";
AWIN.Tracking.Sale.currency = "GBP";
AWIN.Tracking.Sale.test = "0";
AWIN.Tracking.Sale.channel = "aw";
//]]>
</script>
<!--Master Tag add just before the closing </body> tag-->
<script src="https://www.dwin1.com/XXXXXX.js"" type="text/javascript" defer="defer"></script>Replace the following:
XXXXX with your Advertiser ID
GBP with your local currency if you are based outside the UK (e.g. EUR, SEK, USD).
{{order_ref}} with a variable used to generate an ID for each Transaction - it could be a number you already use in your system to keep track of leads or a randomly generated number. The number must be unique as a different ID needs to be generated for each lead.
Important
There are two instances of GBP and {order_ref} in this code - make sure to change both of them.
Example (with dynamic data in client side code)
Here's a simple client side example of how the above could be achieved using PHP:
<!—Image Pixel - Mandatory -->
<img src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=XXXXX&amount=1.00&cr=GBP&ref=<?php echo microtime(true); ?>&parts=DEFAULT:1.00&vc=&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 = "1.00";
AWIN.Tracking.Sale.orderRef = "<?php echo microtime(true); ?>";
AWIN.Tracking.Sale.parts = "DEFAULT:1.00";
AWIN.Tracking.Sale.currency = "GBP";
AWIN.Tracking.Sale.test = "0";
AWIN.Tracking.Sale.channel = "aw";
//]]>
</script>
<!--Master Tag add just before the closing </body> tag-->
<script src="https://www.dwin1.com/XXXXX.js"" type="text/javascript" defer="defer"></script>Final output client code example (with example values)
The above PHP code would load onto the webpage as:
<!—Image Pixel - Mandatory -->
<img src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=XXXXXX&amount=1.00&cr=GBP&ref=1602161929.4418&parts=DEFAULT:1.00&vc=&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 = "1.00";
AWIN.Tracking.Sale.orderRef = "1602161929.4418";
AWIN.Tracking.Sale.parts = "DEFAULT:1.00";
AWIN.Tracking.Sale.currency = "GBP";
AWIN.Tracking.Sale.test = "0";
AWIN.Tracking.Sale.channel = "aw";
//]]>
</script>
<!--Master Tag add just before the closing </body> tag-->
<script src="https://www.dwin1.com/XXXXX.js"" type="text/javascript" defer="defer"></script>Server-side Tracking
Also mandatory for our hybrid tracking is the support of at least one server side tracking request method like Conversion API and/or over direct integration or per Tag System (e.g. GTM). In some shop or tag system the naming can be also webhook or http request or similar.
simple example for orientation in PHP:
<?php
$AwAdvID = "1001"; // replace with your Awin advertiser ID - exampleID here: 1001
$totalAmount = "1.00"; // in case of leads mostly static one (for one lead)
$cookieName = "source"; // Name of the cookie to use for last click referrer de-duplication
$currencyCode = "GBP";
$orderReference = microtime(true);
$commissiongroupcode = "DEFAULT";
$voucherCode = "";
$cks = $_COOKIE["awc"]; // Populate the Awin click checksum if one is associated with the conversion
if (isset($_COOKIE[$cookieName])) {
$paidchannel = $_COOKIE[$cookieName]; // for other paid channels only
} else {
$paidchannel = "aw"; // No paid channel assisted
}
$url = "https://www.awin1.com/sread.php?tt=ss&tv=2";
$url .= "&merchant=" . $AwAdvID;
$url .="&amount=" . $totalAmount;
$url .="&ch=" . $paidchannel;
$url .="&cr=" . $currencyCode;
$url .="&ref=" . $orderReference;
$url .="&parts=" . $commissiongroupcode;
$url .=":" . $totalAmount;
$url .= "&testmode=0&vc=" . $voucherCode;
$url .="&cks=" . $cks; // Populate the Awin click checksum if one is associated with the conversion
$c = curl_init();
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_URL, $url);
curl_exec($c);
curl_close($c);
?>Note: The server-side PHP code is executed when the thankyou-page is requested in user browser, but is not directly visible in the client-side source code, the client browser developer console, or similar. For further examples or in other programming languages, please visit the topic-specific page for server-side integration or for the channel parameter.
To differentiate between new and existing customers, there is also the optional parameter customer acquisition. If CommissionGroupCode (default value: DEFAULT inside parameter called parts) is renamed, it can also be dynamically replaced (for example with LEAD, or similar), but then it must also be set up in the commission manager. Ideally, the CommissionGroupCode description or program description (profile) contains more detailed information about the type of commission or what type of lead is meant. Typical lead use cases can include:
new customer registration
new newsletter registration
online subscription application (with fix commission for registration),
install (e.g.: Mobile app, software (on your OS), game, adware or toolbar/browser extension, etc.)
survey,
competition/raffle/tombola participation,
online ordering of product sample(s),
callback request,
online inquiry or online contract or applications before approval.
Last step - tracking tests
After integrating the Awin tracking you will need to create a test transaction via the Awin platform to check the tracking is working correctly.
Complete the steps to conduct a test transaction via our test transaction guide.
For more information on how to set up and track leads on Awin, watch our tutorial video.