사용자 지정 이벤트 만들기
고유한 업계 데이터를 수집하기 위해 고유한 상점 이벤트를 만들어 이벤트 플랫폼을 확장할 수 있습니다. 사용자 지정 이벤트를 만들고 구성하면 Adobe Commerce 이벤트 수집기로 전송됩니다.
사용자 지정 이벤트 처리
사용자 지정 이벤트는 Adobe Experience Platform에 대해서만 지원됩니다. 사용자 지정 데이터는 Adobe Commerce 대시보드 및 지표 추적기로 전달되지 않습니다.
custom
이벤트의 경우 수집기는
identityMap
을(를) 기본 ID로 사용하는ECID
추가- 이벤트에 보조 ID
email
ifidentityMap
이(가) 설정되었으므로 의personalEmail.address
을(를) 포함합니다. - Edge으로 전달하기 전에
xdm
개체 내에 전체 이벤트를 래핑합니다.
예:
Adobe Commerce 이벤트 SDK을 통해 게시된 사용자 지정 이벤트:
mse.publish.custom({
commerce: {
saveForLaters: {
value: 1,
},
},
});
Experience Platform Edge에서:
{
xdm: {
identityMap: {
ECID: [
{
id: 'ecid1234',
primary: true
}
],
email: [
{
id: "runs@safari.ke",
primary: false
}
]
},
commerce: {
saveForLaters: {
value: 1
}
}
}
}
이벤트 재정의 처리(사용자 지정 속성)
customContext
이(가) 있는 모든 이벤트 집합의 경우 수집기는 이벤트 페이로드의 필드를 custom context
의 필드에서 재정의하거나 확장합니다. 재정의에 대한 사용 사례는 개발자가 이미 지원되는 이벤트에서 페이지의 다른 부분에 의해 설정된 컨텍스트를 재사용하고 확장하려는 경우입니다.
이벤트 재정의는 Experience Platform으로 전달할 때만 적용됩니다. Adobe Commerce 및 Sensei 분석 이벤트에는 적용되지 않습니다. Adobe Commerce 이벤트 수집기 README에서 추가 정보를 제공합니다.
productListItems
을(를) 보강할 때 SKU를 사용하여 제품을 일치시키십시오. 이 요구 사항은 product-page-view
개 이벤트에는 적용되지 않습니다.사용
const mse = window.magentoStorefrontEvents;
mse.publish.productPageView(customCtx);
예 1
이 예제에서는 이벤트를 게시할 때 사용자 지정 컨텍스트를 추가합니다.
magentoStorefrontEvents.publish.productPageView({
productListItems: [
{
productCategories: [
{
categoryID: "cat_15",
categoryName: "summer pants",
categoryPath: "pants/mens/summer",
},
],
},
],
});
예제 2
이 예제에서는 이벤트를 게시하기 전에 사용자 지정 컨텍스트를 추가합니다.
const mse = window.magentoStorefrontEvents;
mse.context.setCustom({
productListItems: [
{
productCategories: [
{
categoryID: "cat_15",
categoryName: "summer pants",
categoryPath: "pants/mens/summer",
},
],
},
],
});
mse.publish.productPageView();
예제 3
이 예제는 게시자에서 사용자 지정 컨텍스트를 설정하고 Adobe 클라이언트 데이터 레이어에 이전에 설정된 사용자 지정 컨텍스트를 덮어씁니다.
이 예제에서 pageView
이벤트는 필드에 사용자 지정 페이지 이름 2web.webPageDetails.name
을 갖게 됩니다.
const mse = window.magentoStorefrontEvents;
mse.context.setCustom({
web: {
webPageDetails: {
name: 'Custom Page Name 1'
},
},
});
mse.publish.pageView({
web: {
webPageDetails: {
name: 'Custom Page Name 2'
},
},
});
예제 4
이 예제에서는 여러 제품이 있는 productListItems
이벤트에 사용자 지정 컨텍스트를 추가합니다.
const mse = window.magentoStorefrontEvents;
mse.context.setCustom({
productListItems: [
{
SKU: "24-WB01", //Match SKU to override correct product in event payload
productCategory: "Hand Bag", //Custom attribute added to event payload
name: "Strive Handbag (CustomName)" //Override existing attribute with custom value in event payload
},
{
SKU: "24-MB04",
productCategory: "Backpack Bag",
name: "Strive Backpack (CustomName)"
},
],
});
mse.publish.shoppingCartView();
Luma 기반 스토어:
Luma 기반 저장소는 기본적으로 게시 이벤트를 구현하므로 customContext
을(를) 확장하여 사용자 지정 데이터를 설정할 수 있습니다.
For example:
mse.context.setCustom({
web: {
webPageDetails: {
name: 'Custom Page Name'
},
},
});