- 20 Nov 2024
- DarkLight
Channel (Deduplication)
- Updated on 20 Nov 2024
- DarkLight
Channel Parameter
We strongly advise all clients utilize the Channel Parameter to instruct our system how to process each conversion based on the source of the traffic.
By populating the Channel
parameter with an identifier, we can subsequently treat the request in four different ways:
Do not process.
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.
In all cases, please ensure that the value of the Channel
parameter is aw
so Awin is deemed as the last-click referrer.
This solution is also, by default, compatible with all of our partners that require an insight into conversions taking place, regardless of the channel that actually won. The behavior from this can be amended easily by the Awin UI.
Please get in touch with your assigned account contact or integrator if you want to set up Deduplication using the Channel Parameter or to change the current behavior configuration.
Parameter Definition
{{channel}}
represents the channel deemed as last-click referrer. For conversions referred from Awin, this parameter should always be set as aw.
In other, less common, use cases it may be set as display
or ppc
. Typically only paid channels concur in deduplication logic. If source info is not available, aw
should always be the fallback value.
Conversion Tag
Template
AWIN.Tracking.Sale.channel = "{{channel}}";
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>
Fall-back Conversion Pixel
Template
&ch={{channel}}
Deduplication
If you are working with multiple marketing channels and/or networks, it is necessary to perform deduplication so that commission is not paid out to multiple traffic sources.
As Awin works with a number of preferred partners, each with their own varying trigger requirements, it is recommended that Awin tracking is displayed unconditionally (exception pages displaying or processing PII) and that the Channel Parameter is used to instruct the system on intended behavior.
Implementation Examples
The following script examples are designed to assist in setting your Channel parameter. If you are making use of a tag management platform such as GTM, this is not necessary; we have pre-defined tagging for this purpose.
We do not provide further support on these scripts beyond the below examples. Further development work by your team may be required for these examples to be used.'
PHP Part 1 - All Pages
To be included in the side header or similar so that it’s run as early as possible on every page of your 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);
}
?>
JavaScript Part 1 - All Pages
To be included on all pages; 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>
PHP Part 2 - Confirmation Page
To be executed on the confirmation page and assumes that the MasterTag is being appended separately.
<?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>
JavaScript Part 2 - Confirmation Page
To be included on the confirmation page. Assumes the MasterTag is appended separately.
<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>