1

In woocommerce, we advertise our products helped by Admitad affiliates. So far, I am using the tracking code from this answer (thanks to @LoicTheAztec):
Order items in a JS tracking code on Order received page in Woocommerce

And this code works perfectly…


Order deduplication

Now I should need some help with order deduplication and here is what Admitad gave to us:

"If you work only with Admitad, use the default value of the deduplication parameter and skip this step.
If you work with several affiliate networks, you are to set up order deduplication on your side. Define the value of the variable ADMITAD.Invoice.broker, so we could understand which source the order belongs to. The value adm indicates orders that belong to Admitad, they will be tracked and get to our statistics. Orders with other values will not be tracked."

Example of deduplication parameters of other affiliate networks:

AWIN.Tracking.Sale.channel = "adm"; // http://wiki.awin.com/index.php/Advertiser_Tracking_Guide/De-duplication

window.criteo_q.push({ event: "trackTransaction", deduplication: "adm", <...>); // https://support.criteo.com/hc/en-us/articles/205573701-Deduplication-Parameter

Below is an example of using the cookie to store the last click source. The click source is determined based on the value of the GET parameter when the user goes to the website. The cookie is stored for a certain number of days, the cookie value is used to determine the deduplication parameter.

// name of the cookie that stores the source

var cookie_name = 'deduplication_cookie';

// cookie lifetime

var days_to_store = 90;


// a function to get the source from the GET parameter

getSourceParamFromUri = function () {

// in the example we use the GET parameter deduplication_channel to define 
the source 

// if you use another parameter, specify its name in a regular expression

  return (/deduplication_channel=([^&]+)/.exec(document.location.search) || 
[])[1] || '';

};


// a function to get the source from the cookie named cookie_name

getSourceCookie = function () {

  var matches = document.cookie.match(new RegExp(

      "(?:^|; )" + cookie_name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, 
'\\$1') + "=([^;]*)"

  ));

  return matches ? decodeURIComponent(matches[1]) : undefined;

};


// a function to set the source in the cookie named cookie_name

setSourceCookie = function () {

  var param = getSourceParamFromUri();

  if (!param) { return; }

  var period = days_to_store * 60 * 60 * 24 * 1000; // in seconds

  var expiresDate = new Date((period) + +new Date);

  var cookieString = cookie_name + '=' + param + '; path=/; expires=' + 
expiresDate.toGMTString();

  document.cookie = cookieString;

  document.cookie = cookieString + '; domain=.' + location.host;

};


// set cookie

setSourceCookie();


// define a channel for Admitad

if (getSourceCookie(cookie_name)) {

  ADMITAD.Invoice.broker = getSourceCookie(cookie_name);

} else {

  ADMITAD.Invoice.broker = 'na';

}

Does anyone can help us to create and integrate with our tracking code this order deduplication?

Community
  • 1
  • 1
  • I've got this error ADMITAD.Invoice.broker = 'na'; ( Uncaught Reference Error: ADMITAD is not defined ) . any help with this ? @LoicTheAztec – Daniel Florea Dec 11 '18 at 21:14

0 Answers0