- 06 Feb 2025
- DarkLight
Implementing Awin Consent
- Updated on 06 Feb 2025
- DarkLight
Overview
Our Consent Signal Framework contains a key property for the AWIN.Tracking
object: AdvertiserConsent
.
When set, the MasterTag will read its value and, based on this value, decide whether or not to set a cookie (on the landing page) and, furthermore, to read the value of the cookies on your order confirmation page.
Depending on your site infrastructure, please choose the most applicable method for implementation. If you’re unsure or have any questions, please reach out to your Awin point-of-contact.
Notice:
If your site makes use of Google Tag Manager, you can complete this process using our GTM Consent Tag.
⚠️ Consent Signal Disclaimer
If you're not making use of the consent parameters, then Awin assumes you've obtained cookie consent from the website visitor as per the ‘Advertiser Agreement’ for any traffic sent to us.
If you indicate that we don't have consent from the website visitor, we don't set a cookie on your landing page and we don’t read first-party or process third party cookies on the checkout page, with the only exception to when cookies are considered as strictly necessary as for cashback and loyalty activities.
If any value besides true
/false
and 1
/0
are passed, they will be treated as if no value was specified.
Partner plugins are not covered by Consent Signals. If you are using any partner plugins, then please reach out to the Awin Technical Support team for advice.
Direct Implementation
The following examples serve to illustrate code function and best practice for handling our consent model. The necessary code and/or variables in use on your site may differ.
Mirroring the applicable information across the client and server sides of this process is vital to ensuring that data integrity is maintained across multiple tracking methods.
On the Landing Page
If the consumer navigated through an affiliate link, an affiliate click identifier will be present in the URL and the MasterTag will attempt to set a first-party affiliate cookie.
If consent has not been obtained (a consent window is yet to be presented to the consumer), then the MasterTag should be executed on page load.
The MasterTag should always be loaded on page load, regardless of consent status.
To inform the MaserTag that it should delay setting a first-party cookie, please add the following:
var AWIN = AWIN || {};
AWIN.Tracking = AWIN.Tracking || {};
AWIN.Tracking.AdvertiserConsent = false;
<script src="https://www.dwin1.com/{{advertiserId}}.js" defer="defer"></script>
This should be added before the MasterTag is loaded.
After initializing the above variable, based on the choice of the consumer, you can send a consent update event to the MasterTag by calling:
AWIN.Tracking.Consent.setAdvertiserConsentStatus(true); //cookie consent was obtained for Awin
AWIN.Tracking.Consent.setAdvertiserConsentStatus(false); //cookie consent was not obtained for Awin
We accept values of 1
and 0
as true
and false
, respectively.
Please ensure that the URL query parameters, especially Awin parameters (&awc
= and &sn=
) appended by Awin to the landing page URL, are still available when the consent update is sent.
If the customer has visited your site before, a consent banner may not be presented to them again. This means that you (or your CMP) have stored the consumer’s consent status on your end. In this case, we recommend loading the following snippet on all pages of your site:
var AWIN = AWIN || {};
AWIN.Tracking = AWIN.Tracking || {};
AWIN.Tracking.AdvertiserConsent = {{consentForAwinStatus}};
<script src="https://www.dwin1.com/{{advertiserId}}.js" defer="defer"></script>
The {{consentForAwinStatus}}
should be populated by the variable that you’re using to store the consent status.
On the Confirmation Page
On your order confirmation page, the MasterTag reads the value of the AdvertiserConsent property and decides whether or not to read Awin’s first-party cookies. Therefore, the AdvertiserConsent property should be initialized as a part of the Conversion Tag.
On this page, it is also necessary to append the cons parameter to the Conversion Pixel and populate it with the value of the {{consentForAwinStatus}} variable.
<img border="0" height="0" src="https://www.awin1.com/sread.img?tt=ns&tv=2&merchant={{advertiserId}}
&amount={{totalAmount}}&ch={{channel}}&cr={{currencyCode}}&p1={{customParameter1}}
&p2={{customParameter2}}&parts=DEFAULT:{{totalAmount}}&ref={{orderReference}}
&testmode={{isTest}}&vc={{voucherCode}}&cons={{consentForAwinStatus}}" 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 = "{{totalAmount}}";
AWIN.Tracking.Sale.channel = "{{channel}}";
AWIN.Tracking.Sale.currency = "{{currencyCode}}";
AWIN.Tracking.Sale.custom = ["{{customParameter1}}", "{{customParameter2}}"];
AWIN.Tracking.Sale.orderRef = "{{orderReference}}";
AWIN.Tracking.Sale.parts = "DEFAULT:{{totalAmount}}";
AWIN.Tracking.Sale.test = "{{isTest}}";
AWIN.Tracking.Sale.voucher = "{{voucherCode}}";
AWIN.Tracking.AdvertiserConsent = {{consentForAwinStatus}};
//]]>
</script>
<script defer="defer" src="https://www.dwin1.com/{{advertiserId}}.js" type="text/javascript"></script>
On the Landing Page
As with the client-side portion, you should create Awin cookies based on the consent status, ensuring that the “strictly necessary cookie” scenario is covered.
If the “sn=
” parameter is in the URL of the landing page, the script should then create the strictly necessary awc_sn
cookie, otherwise, it will try to create a regular cookie based on the consent status.
Below is a reference snippet where the $consent
variable is used to determine the consumer’s consent status.
If your infrastructure is not PHP-controlled, use these scripts as reference for the applicable language.
<?php
function setAwc() {
if ($_GET['awc']) {
if ($_GET['sn']){
//set strinctly necessary cookie
setcookie("awc_sn",$_GET['awc'],time()+ 60 * 60 * 24 * 365,"/",
"example.com", true, true );
} elseif ($consent == True) {
//set normal cookie
setcookie("awc",$_GET['awc'],time()+ 60 * 60 * 24 * 365,"/",
"example.com", true, true );
}
}
}
On the Confirmation Page
You should ensure that normal cookies are not passed to the S2S Pixel when consent is not given.
The strictly necessary cookie (awc_sn
) should be passed to the S2S Pixel unconditional of consent. If multiple cookies are found in the browser and are a part of the same user journey then all of them should be read (concatenated into a string and separated by an HTML-encoded comma (e.g. %2C
).
Below is a reference snippet where the $consent
variable is used to determine the consumer’s consent status. The script also uses a $cookies
variable to store the cookie values, concatenated with a comma.
<?php
$url = "https://www.awin1.com/sread.php?tt=ss&tv=2&merchant=18311";
$url .= "&amount=" . $orderSubtotal;
$url .="&ch=" . $channel;
$url .="&cr=" . $currencyCode;
$url .="&ref=" . $orderRef;
$url .="&parts=" . $commissionGroup .":" . $saleAmount;
$url .= "&vc=" . $voucherCode;
$url .="&customeracquisition=" . $customerAcquisition;
$cookies ="";
//read normal cookie
if ($consent == True) {
if (isset($awc)) {
$cookies .= $awc;
}
}
//read sn cookie
if (isset($awc_sn)) {
if (empty($cookies)){
$cookies .= $awc_sn;
} else {
$cookies .= "%2C" . $awc_sn;
}
}
$url .= "&cks=" . $cookies; // Populate the affiliate click
$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);
?>