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?
javascript php cookies woocommerce tracking
add a comment |
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?
javascript php cookies woocommerce tracking
add a comment |
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?
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 2 days ago
LoicTheAztec
79.8k125992
79.8k125992
asked 2 days ago
Daniel Florea
134
134
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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