SDK事件(Node.js)
最後更新: 2024年7月20日
建立對象:
- undefined
說明
當初始化SDK時,options.events
物件為具有事件名稱索引鍵和回呼函式值的選用物件。 可用來訂閱SDK內發生的各種事件。 例如,clientReady
事件可與回呼函式搭配使用,當SDK準備好進行方法呼叫時,將會叫用該回呼函式。
呼叫回呼函式時,事件物件會傳入。 每個事件都有一個type
對應至事件名稱。 有些事件包含其他屬性以及相關資訊。
事件
事件名稱(型別) | 說明 | 其他事件屬性 |
---|---|---|
clientready | 已在下載成品且SDK已準備好進行getOffers 呼叫時發出。 使用裝置上決策方法時建議使用。 | |
artifactDownloadSucceeded | 每次下載新成品時發出。 | artifactPayload, artifactLocation |
artifactDownloadFailed | 每當成品無法下載時發出。 | artifactLocation,錯誤 |
範例
Node.js
const targetClient = TargetClient.create({
client: "acmeclient",
organizationId: "1234567890@AdobeOrg",
decisioningMethod: "on-device",
events: {
clientReady: onTargetClientReady,
artifactDownloadSucceeded: onArtifactDownloadSucceeded,
artifactDownloadFailed: onArtifactDownloadFailed
}
});
function onTargetClientReady() {
// make getOffers requests
targetClient.getOffers({...})
}
function onArtifactDownloadSucceeded(event) {
console.log(`The artifact was successfully downloaded from '${event.artifactLocation}'`);
// optionally do something with event.artifactPayload, like persist it
}
function onArtifactDownloadFailed(event) {
console.log(`The artifact failed to download from '${event.artifactLocation}' with the following error message: ${event.error.message}`);
}
Target
- Adobe Target開發人員指南
- 快速入門
- 使用者端實作
- 概覽:為用戶端 Web 實作 Target
- Adobe Experience Platform Web SDK實作概觀
- at.js 實施
- at.js概覽
- at.js 如何運作
- 如何部署 at.js
- 裝置上決策
- at.js 函數
- at.js 函數概覽
- adobe.target.getOffer()
- adobe.target.getOffers() - at.js 2.x
- adobe.target.applyOffer()
- adobe.target.applyOffers() - at.js 2.x
- adobe.target.triggerView() - at.js 2.x
- adobe.target.trackEvent()
- mboxCreate() - at.js 1.x
- targetGlobalSettings()
- mboxDefine() 和 mboxUpdate() - at.js 1.x
- targetPageParams()
- targetPageParamsAll()
- registerExtension() - at.js 1.x
- sendNotifications() - at.js 2.1
- at.js 自訂事件
- 使用 Adobe Experience Cloud Debugger 除錯 at.js
- 使用雲端型例項搭配 Target
- at.js 常見問答
- at.js 版本詳細資料
- 從 at.js 1.x 升級為 at.js 2.x
- at.js Cookie
- 使用者代理和使用者端提示
- 瞭解全域 mbox
- 伺服器端實作
- 混合實施
- Recommendations實施
- 行動應用程式實作
- 電子郵件實作
- API指南
- 實作模式