Advertiser Tracking Guide/De-duplication

From Wiki

Jump to: navigation, search

[-] Advertiser Tracking Guide

[-] De-duplication

If you are working with multiple marketing channels and/or networks it is necessary to perform de-duplication so that commission is not paid out to several traffic sources for the same conversion.

What is important to remember though, is that some of our preferred partners, which you may choose to work with, require their own tracking to trigger for all conversions. For example remarketers will utilise their own tracking to stop them from retargeting the same customers after they already have completed the relevant purchase.

This means ideally we would require our tracking to be displayed unconditionally, however you can utilise the Channel Parameter to instruct our system to behave differently depending on which channel wins.


[-] Channel Parameter

Awin strongly advise all clients to utilise the Channel Parameter to instruct our system how to process each conversion based on the source of the traffic.

By populating it with a code / name for the channel that won the conversion in question, we can subsequently treat the request in four different ways:

  • Do not process what-so-ever
  • Process if any Awin cookie is present
  • Only process if an Awin click cookie is present
  • Only process if an Awin post-view cookie is present

File:Information.png

Make sure you always populate the parameter with the value "aw" if Awin is deemed as last click referrer.

The solution is also by default compatible with all our partners that require an insight into all the conversions that are taking place regardless of which channel actually won and the behaviour configuration can be amended easily and swiftly.

Please get in touch with your account contact or assigned integrator if you want to set up de-duplication using the Channel Parameter or change the current behaviour configuration.

Tracking could go down if you have an existing programme running with Awin and you incorrectly implement the Channel Parameter or make changes to how it is being declared!


Template - Conversion Tag

AWIN.Tracking.Sale.channel = "{{channel}}";


Template - Fall-back Conversion Pixel

&ch={{channel}}


  • {{channel}} must be replaced by the code / name for the channel that is deemed as the last click referrer for the conversion in question, for example "aw" (which always should be used for Awin), "display" or "ppc". If no paid channel assisted then we recommend declaring "na"

Channel values must be no longer than 20 alpha-numeric (0-9, A-Z, a-z) characters.


Example

<img border="0" height="0" src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=1001&amount=8.33&ch=email&parts=DEFAULT:8.33&ref=AA000001&testmode=0" style="display: none;" width="0">
<script type="text/javascript">
//<![CDATA[
/*** Do not change ***/
var AWIN = {};
AWIN.Tracking = {};
AWIN.Tracking.Sale = {};
/*** Set your transaction parameters ***/
AWIN.Tracking.Sale.amount = "8.33";
AWIN.Tracking.Sale.channel = "email";
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 Implementations

A couple of fully functional de-duplication templates which can be tailored to the requirements of your web platform.

File:Information.png

Unfortunately we do not provide any further development support on the examples themselves.


Source Handler - PHP

To be included in the side header or similar so that it is being run as early as possible on every page of the site.

<?php 
 
$cookieLength = 30; // Cookie length in days
$cookieName = "source"; // Name of the first party cookie to utilise for last click referrer de-duplication
$sourceParameterName = "source"; // The parameter used by networks and other marketing channels to tell you who drove the traffic
 
if (isset($_GET[$sourceParameterName])) {
    setcookie($cookieName, strip_tags($_GET[$sourceParameterName]), time() + (60 * 60 * 24 * $cookieLength), "/", "." . $_SERVER["SERVER_NAME"]);
}
 
?>


Source Handler - JavaScript

To be included on all pages; make sure this snippet is executed as early as possible during page load.

<script type="text/javascript">
var iCookieLength = 30; // Cookie length in days
var sCookieName = "source"; // Name of the first party cookie to utilise for last click referrer de-duplication
var sSourceParameterName = "source"; // The parameter used by networks and other marketing channels to tell you who drove the traffic
 
var _getQueryStringValue = function (sParameterName) {
    var aQueryStringPairs = document.location.search.substring(1).split("&");
    for (var i = 0; i < aQueryStringPairs.length; i++) {
        var aQueryStringParts = aQueryStringPairs[i].split("=");
        if (sParameterName.toLowerCase() == aQueryStringParts[0].toLowerCase()) {
            return aQueryStringParts[1];
        }
    }
};
 
var _setCookie = function (sCookieName, sCookieContents, iCookieLength) {
    var dCookieExpires = new Date();
    dCookieExpires.setTime(dCookieExpires.getTime() + (iCookieLength * 24 * 60 * 60 * 1000));
    document.cookie = sCookieName + "=" + sCookieContents + "; expires=" + dCookieExpires.toGMTString() + "; path=/;";
};
 
if (_getQueryStringValue(sSourceParameterName)) {
    _setCookie(sCookieName, _getQueryStringValue(sSourceParameterName), iCookieLength);
}
</script>


Confirmation Page Tracking - PHP

To be executed on the confirmation page and assumes the Mastertag is being appended separately using a side footer inclusion or similar.

<?php 
 
$cookieName = "source"; // Name of the cookie to use for last click referrer de-duplication
 
if (isset($_COOKIE[$cookieName])) {
    $channel = $_COOKIE[$cookieName];
} else {
    $channel = "na"; // No paid channel assisted
}
 
?>
<img border="0" height="0" src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant=1001&amount=<?php echo $totalAmount; ?>&ch=<?php echo $channel; ?>&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.Tracking = {};
AWIN.Tracking.Sale = {};
/*** Set your transaction parameters ***/
AWIN.Tracking.Sale.amount = "<?php echo $totalAmount; ?>";
AWIN.Tracking.Sale.channel = "<?php echo $channel; ?>";
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>


Confirmation Page Tracking - JavaScript

To be included on the confirmation page and assumes the Mastertag is being appended separately using a side footer inclusion or similar.

<script type="text/javascript">
var sCookieName = "source"; // Name of the cookie to use for last click referrer de-duplication
 
var _getCookie = function (sCookieName) {
    sCookieName += "=";
    var aCookies = document.cookie.split(";");
    for (var i = 0; i < aCookies.length; i++) {
        while (aCookies[i].charAt(0) == " ") aCookies[i] = aCookies[i].substring(1);
        if (aCookies[i].indexOf(sCookieName) != -1) {
            return aCookies[i].substring(sCookieName.length, aCookies[i].length);
        }
    }
};
 
if (_getCookie(sCookieName)) {
    var sChannel = _getCookie(sCookieName);
} else {
    var sChannel = "na"; // No paid channel assisted
}
 
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 + "&cr=" + sCurrency + "&parts=DEFAULT:" + parseFloat(fTotalAmount).toFixed(2) + "&ref=" + sOrderReference + "&testmode=0&vc=" + sVoucherCode;
 
var AWIN = {};
AWIN.Tracking = {};
AWIN.Tracking.Sale = {};
AWIN.Tracking.Sale.amount = parseFloat(fTotalAmount).toFixed(2);
AWIN.Tracking.Sale.channel = sChannel;
AWIN.Tracking.Sale.currency = sCurrency;
AWIN.Tracking.Sale.orderRef = sOrderReference;
AWIN.Tracking.Sale.parts = "DEFAULT:" + parseFloat(fTotalAmount).toFixed(2);
AWIN.Tracking.Sale.test = "0";
AWIN.Tracking.Sale.voucher = sVoucherCode;
</script>

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