Order deduplication tracking code woocommerce
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
add a comment |
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
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
add a comment |
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
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
javascript php cookies woocommerce tracking
edited Nov 20 '18 at 21:55
LoicTheAztec
90.4k1365104
90.4k1365104
asked Nov 20 '18 at 16:18
Daniel FloreaDaniel Florea
134
134
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
add a comment |
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
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
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
add a comment |
0
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',
autoActivateHeartbeat: false,
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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