Get Offers (Node.js)
說明
getOffers()
用於執行決定並從Adobe Target擷取體驗。
方法
getOffers
TargetClient.getOffers(options: Object): Promise
參數
options
物件具有下列結構:
名稱
類型
必要
預設值
說明
visitorCookie
字串
無
無
ECID (VisitorId) Cookie
targetCookie
字串
無
無
Target Cookie
targetLocationHint
字串
無
無
Target位置提示
consumerId
字串
否
無
Analytics for Target (A4T)拼接的consumerIds
CustomerIds
陣列
否
無
VisitorId相容格式的客戶ID
sessionId
字串
無
無
用於連結多個Target請求
訪客
物件
無
新VisitorId
提供外部VisitorId例項
Promise
Promise
傳回的結構如下:
名稱
類型
說明
visitorState
物件
應傳遞給訪客API
getInstance()
的物件targetCookie
物件
Target Cookie
targetLocationHintCookie
物件
Target位置提示Cookie
analyticsDetails
陣列
使用使用者端Analytics時的Analytics裝載
trace
陣列
所有請求mbox/檢視的彙總追蹤資料
狀態
物件
包含回應狀態的物件。
用來將資料傳回瀏覽器的targetCookie
和targetLocationHintCookie
物件具有以下結構:
名稱
類型
說明
名稱
字串
Cookie 名稱
value
任何
Cookie值,則會轉換為字串
maxAge
數字
maxAge
選項可方便您設定相對於目前時間(以秒為單位)的過期時間用於表示目標回應狀態的status
物件具有下列結構:
名稱
類型
說明
狀態
數字
HTTP狀態代碼
範例
Node.js
const TargetClient = require("@adobe/target-nodejs-sdk");
const CONFIG = {
client: "acmeclient",
organizationId: "1234567890@AdobeOrg"
};
const targetClient = TargetClient.create(CONFIG);
const request = {
context: {channel: "web"},
execute: {
mboxes: [{
name: "a1-serverside-ab",
index: 1
}]
}};
const response = await targetClient.getOffers({ request });
recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3