Order deduplication tracking code woocommerce











up vote
1
down vote

favorite












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?










share|improve this question




























    up vote
    1
    down vote

    favorite












    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?










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      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?










      share|improve this question















      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?







      javascript php cookies woocommerce tracking






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 2 days ago









      LoicTheAztec

      79.8k125992




      79.8k125992










      asked 2 days ago









      Daniel Florea

      134




      134





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53397213%2forder-deduplication-tracking-code-woocommerce%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53397213%2forder-deduplication-tracking-code-woocommerce%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Berounka

          Different font size/position of beamer's navigation symbols template's content depending on regular/plain...

          Sphinx de Gizeh