[Alpha]{class="badge informative"}

xdm (伺服器SDK)

此頁面說明伺服器SDK sendEvent方法中的xdm。 若為Web SDK,請參閱xdm.

xdm物件包含您以符合體驗資料模型(XDM)結構描述的結構傳送至Adobe的資料。 您在此物件中設定的欄位會直接對應到資料流傳送資料之資料集結構描述中的欄位。

確定此物件中的階層符合已設定資料集的結構描述。 您可以在同一sendEvent呼叫中同時包含xdm物件和data物件。

下列範例使用Commerce詳細資料結構描述欄位群組:

await visitor.sendEvent({
  xdm: {
    eventType: "commerce.productViews",
    identityMap: {
      Email: [{ id: "visitor@example.com", primary: true }]
    },
    commerce: {
      productViews: { value: 1 }
    },
    productListItems: [
      { SKU: "HT105", name: "Large field hat" },
      { SKU: "HT104", name: "Small field hat" }
    ]
  }
});

包含主要身分 primary-identity

伺服器SDK傳送的每個事件都必須在xdm.identityMap中包含主要身分。 在瀏覽器中,Edge Network可以識別來自Cookie的訪客。 在伺服器對伺服器要求中,它需要在事件本身有身分。 如果事件中沒有標籤為主要身分識別,則Edge Network會拒絕事件,錯誤碼為EXEG-0306-400,且sendEvent會拒絕。

在單一身分上設定primary: true:

xdm: {
  identityMap: {
    Email: [
      { id: "visitor@example.com", primary: true }
    ],
    CRMID: [
      { id: "1234567" }
    ]
  }
}

identityMap中的每個索引鍵都是定義在您的組織中的身分識別名稱空間,每個值是該名稱空間中的身分識別陣列。 如需詳細資訊,請參閱使用identityMap。

SDK新增的資料 automatic

SDK將xdm.implementationDetails新增至每個事件,並可從請求的Referer標頭新增xdm.web.webPageDetails.URL。 如果您也設定xdm.web.webPageDetails.URL,則會使用您的值。 請參閱內容與轉送的標頭。

如果您同時設定xdm.eventType和type選項,則會使用xdm.eventType中的值。

recommendation-more-help
experience-platform-help-collection