在woocommerce中,我们通过 Admitad关联公司进行广告宣传。
到目前为止,我正在使用此答案(由于@LoicTheAztec)中的跟踪代码:
Order items in a JS tracking code on Order received page in Woocommerce
此代码可以完美运行...
现在我应该在重复数据删除方面需要一些帮助,这是Admitad给我们的:
”如果仅使用Admitad,请使用重复数据删除参数的默认值,并跳过此步骤。
如果您与多个会员网络合作,则应在自己的位置设置订单重复数据删除。定义变量ADMITAD.Invoice.broker的值,这样我们就可以了解该订单属于哪个来源。 adm值表示属于Admitad的订单,将对其进行跟踪并获得我们的统计信息。具有其他值的订单将不会被跟踪。“
其他附属网络的重复数据删除参数示例:
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
以下是使用Cookie存储最终点击来源的示例。当用户访问网站时,基于GET参数的值确定点击来源。 Cookie会存储一定天数,该Cookie值用于确定重复数据删除参数。
// 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';
}
有人可以帮助我们创建该订单重复数据删除并将其与我们的跟踪代码集成吗?