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 (excluding pages which display or process payment information), 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! If channel is empty or has the value "undefined", transactions will be tracked, ignoring the configuration "Don't track" from the UI.


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". Typically only paid channels concur in de-duplication logic. If source info is not available then "aw" should always be the fall-back value.

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 || {};
AWIN.Tracking = 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, to be matched with programs' cookie lenght
$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
$domain = "example.com" // Cookie should always be set on eTLD+1 domain i.e. example.com instead of subdomain.example.com.
 
if ($_GET[$sourceParameterName]) {
setcookie($cookieName, strip_tags($_GET[$sourceParameterName]), time() + (60 * 60 * 24 * $cookieLength), "/", $domain, true, true);
}
 
if (!empty($_GET['awc'])) {
setcookie("awc",$_GET['awc'],time()+ 60 * 60 * 24 * 365,"/", $domain, true, true);
}
 
 
?>


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 domain = "example.com"; // top level domain
 
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, tlDomain) {
    var dCookieExpires = new Date();
    dCookieExpires.setTime(dCookieExpires.getTime() + (iCookieLength * 24 * 60 * 60 * 1000));
    document.cookie = sCookieName + "=" + sCookieContents + "; expires=" + dCookieExpires.toGMTString() +";domain=" + tlDomain + "; path=/;";
};
 
if (_getQueryStringValue(sSourceParameterName)) {
    _setCookie(sCookieName, _getQueryStringValue(sSourceParameterName), iCookieLength, domain);
}
</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 = "aw"; // No paid channel assisted
}
 
$url = "https://www.awin1.com/sread.php?tt=ss&tv=2&merchant=1001";
 
$url .= "&amount=" . $totalAmount;
$url .= "&ch=" . $channel;
$url .= "&cr=" . $currencyCode;
$url .= "&ref=" . $orderReference;
$url .= "&parts=DEFAULT:" . $totalAmount;
$url .= "&testmode=0&vc=" . $voucherCode;
$url .= "&cks=" . $_COOKIE["awc"]; // 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);
 
?>
 
 
<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 || {};
AWIN.Tracking = 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 = "aw"; // No paid channel assisted
}
 
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 + "&cr=" + sCurrency + "&parts=DEFAULT:" + parseFloat(fTotalAmount).toFixed(2) + "&ref=" + sOrderReference + "&testmode=0&vc=" + sVoucherCode;
 
var AWIN = AWIN || {};
AWIN.Tracking = 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