Adobe 商务事件收集器
概览
此软件包会收听和处理由 KTC 发布的事件 Adobe 商务活动 SDK 转到 adobeDataLayer缩写。它作为副作用运行,意在为想要向Adobe Commerce发送事件数据的用户提供方便.
安装
收集器可以用作主机脚本,也可以被捆绑在JavaScript应用程序中. 脚本版本托管于 兹德利夫尔,则捆绑的版本在 无。 。 。 .
要将收集器装入脚本, 请使用以下片段 .
<script src="https://cdn.jsdelivr.net/npm/@adobe/commerce-events-collectors/dist/index.js"></script>
要将脚本安装为依赖, 请运行此命令 .
npm install @adobe/commerce-events-collectors
快开始
在加载收集器脚本后,或导入下面显示的包后,没有其他需要做的事情.
import "@adobe/commerce-events-collectors";
使用量
收藏家为以下事件聆听.
pageViewaddToCartproductPageViewshoppingCartViewinitiateCheckoutopenCartplaceOrderrecsItemAddToCartClickrecsItemClickrecsRequestSentrecsResponseReceivedrecsUnitRenderrecsUnitViewremoveFromCartsearchCategoryClicksearchProductClicksearchRequestSentsearchResponseReceivedsearchResultsViewcategoryResultsViewsearchSuggestionClickcreateAccounteditAccountsignInsignOutcustom
B2B事件
createRequisitionListdeleteRequisitionListaddToRequisitionListremoveFromRequisitionList
处理器将事件推进到两个边缘:
-
Adobe Commerce Data Services (由Adobe Engineering维护并用于为商家的性能仪表板提供动力) 互联网档案馆的存檔,存档日期2013-12-21
所需上下文 :
StorefrontInstance
未转交 Adobe Commerce 的事件 :
createAccounteditAccountopenCartremoveFromCartsignInsignOutcustom
B2B事件:
createRequisitionListdeleteRequisitionListaddToRequisitionListremoveFromRequisitionList
-
Adobe 体验平台 (需要订阅和额外商户) 设置;数据可以被Adobe体验平台内的商人用来进行详细的分析,有针对性地进行交易,实时客户数据简介等)
所需上下文 :
AEPEventForwarding.aep: true
未转发到 AEP 边缘的事件 :
recsItemAddToCartClickrecsItemClickrecsRequestSentsearchResponseReceivedsearchCategoryClicksearchProductClicksearchResultsViewcategoryResultsViewsearchSuggestionClick
每个边缘关闭收藏
事件默认会发送给Adobe Commerce Data Services. 要关闭收藏, 设置 EventForwarding.commerce: false。 。 。 .
除非明确配置,否则事件不会被设定为AEP边缘(EventForwarding.aep: true(三);
处理自定义事件
自定义事件只为Adobe体验平台所支持. 自定义数据不会被传送到Adobe商业仪表板和度量衡跟踪器.
对于任何 custom 事件,收藏者:
- 添加
identityMap与ECID作为主要身份 - 包含
email内identityMap作为次要身份 若为personalEmail.address设置在事件 - 将全部事件覆盖在
xdm对象在转发到边缘之前
示例
通过 MSE SDK 发布的自定义事件 :
mse.publish.custom({
commerce: {
saveForLaters: {
value: 1,
},
},
});
在AEP边缘:
{
xdm: {
identityMap: {
ECID: [
{
id: 'ecid1234',
primary: true
}
],
email: [
{
id: "[email protected]",
primary: false
}
]
},
commerce: {
saveForLaters: {
value: 1
}
}
}
}
说明 使用自定义事件可能影响OOTB Adobe Analytics报告.
处理事件覆盖( 自定义属性)
只支持经验平台的标准活动属性覆盖。 自定义数据不会被传送到商务仪表板和度量衡跟踪器.
对于任何有设定的事件 customContext中,收藏器将连接在相关背景中设置的字段与在 customContext。超接的用例是开发者想要在已经支持的事件中重新使用并扩展页面其他部分设定的上下文.
说明 当超过自定义事件时,向 AEP 转发的事件应当为该事件类型而关闭,以避免重复计算.
示例
Adobe Commerce 的产品视图覆盖了通过 MSE SDK 发布的 :
产品上下文( 由页面上的另一个脚本设置) :
{
}
mse.publish.productPageView({
productListItems: [
{
productCategories: [
{
categoryID: "cat_15",
categoryName: "summer pants",
categoryPath: "pants/mens/summer",
},
],
},
],
});
在AEP边缘:
{
xdm: {
eventType: 'commerce.productViews',
identityMap: {
ECID: [
{
id: 'ecid1234',
primary: true,
}
]
},
commerce: {
productViews: {
value : 1,
}
},
productListItems: [{
SKU: "1234",
name: "leora summer pants",
productCategories: [{
categoryID: "cat_15",
categoryName: "summer pants",
categoryPath: "pants/mens/summer",
}],
}],
}
}
说明 覆盖带有自定义属性的事件可能影响OOTB Adobe Analytics报告.
Shopper 同意和数据收集
"mg dnt"饼干被"产品建议"用来限制数据收集.
当 饼干限制模式 启用后,数据服务将设置“ mg dnt” cookie 为正版 .
const listenForCookieEvents = ($) => {
const DNT_COOKIE = "mg_dnt";
let userAllowedSaveCookie = !!$.mage.cookies.get("user_allowed_save_cookie");
if (userAllowedSaveCookie) {
$.mage.cookies.clear(DNT_COOKIE);
} else {
$.mage.cookies.set(DNT_COOKIE, true);
}
};
默认情况下,AEP中的用户同意优先被设定为"opt in",除非启用了cookie限制模式并存在"mg dnt"cookie.
脚本会保持投票,以检查任何更改,并将更新后的优先选择发送到AEP.
const doNotTrackCookie = document.cookie.indexOf("mg_dnt") !== -1;
alloy("setConsent", {
consent: [
{
standard: "Adobe",
version: "1.0",
value: {
general: doNotTrackCookie ? "out" : "in",
},
},
],
});
setInterval(setConsent, 1000);
PII 数据收集
以下事件将用户的电子邮件作为 PII 数据转发给 AEP :
createAccount
editAccount
signIn
支助
如果您有任何问题或遇到任何问题,请联系这些地点.