透過Adobe Target實現個人化
概觀 overview
Edge Network Server API可協助提供和轉譯在Adobe Target中建立的個人化體驗。 表單式體驗撰寫器.
設定您的資料串流 configure-your-datastream
您必須先在資料流設定上啟用Adobe Target個人化,才能將伺服器API與Adobe Target搭配使用。
請參閱 新增服務至資料流的指南,以取得如何啟用Adobe Target的詳細資訊。
設定資料流時,您可以(選擇性)提供下列專案的值 Property Token, Target Environment ID、和 Target Third Party ID Namespace.
自訂參數 custom-parameters
中的大部分欄位 XDM 每個請求的部分都會序列化為點標籤法,然後以自訂或的形式傳送至Target mbox 引數。
範例 custom-parameters-example
提供下列XDM範例:
"xdm":{
"marketing":{
"campaignGroup":"winter22",
"campaignName":"homeOwnerPromo22",
"trackingCode":"hop22"
}
}
在Target中建立對象時,下列值可作為自訂引數使用:
marketing.campaignGroup
marketing.campaignName
marketing.trackingCode
Target設定檔更新 profile-update
此 Server API 允許更新Target設定檔。 若要更新Target設定檔,請確定設定檔資料已傳入 data
請求的一部分,格式如下:
"data": {
"__adobe.target": {
"profile.eyeColor": "brown",
"profile.hairColor": "brown"
}
}
查詢Target活動 querying-target-activities
結構描述 schemas
請求的查詢部分決定了Target會傳回哪些內容。 在 personalization
物件, schemas
決定Target要傳回的內容型別。
若您不確定要擷取哪一種選件,則應在Edge Network的個人化查詢中納入全部四個結構描述:
- HTML型優惠方案:
https://ns.adobe.com/personalization/html-content-item - json型選件:
https://ns.adobe.com/personalization/json-content-item - Target重新導向選件
https://ns.adobe.com/personalization/redirect-item - 目標DOM操作選件
https://ns.adobe.com/personalization/dom-action
決定範圍 decision-scopes
Adobe Target mbox 名稱應包含在 decisionScopes
陣列以傳回適當的內容。
範例 decision-scopes-example
在以下範例中,將會要求所有四種選件型別以及一個名為的Target活動 serverapimbox
.
"query":{
"personalization":{
"schemas":[
"https://ns.adobe.com/personalization/html-content-item",
"https://ns.adobe.com/personalization/json-content-item",
"https://ns.adobe.com/personalization/redirect-item",
"https://ns.adobe.com/personalization/dom-action"
],
"decisionScopes":[
"serverapimbox"
]
}
}
API呼叫範例 api-example
API格式
POST /ee/v2/interact
請求 request
包含完整XDM物件、設定檔引數以及適當Target查詢的完整請求概述如下。
curl -X POST 'https://server.adobedc.net/ee/v2/interact?dataStreamId={DATASTREAM_ID}' \
--header 'x-api-key: {API_KEY}' \
--header 'x-gw-ims-org: {ORG_ID}' \
--header 'Authorization: Bearer {TOKEN}' \
--header 'Content-Type: application/json' \
--data-raw '{
"event": {
"xdm": {
"eventType": "web.webpagedetails.pageViews",
"identityMap": {
"ECID": [
{
"id": "05907638112924484241029082405297151763",
"authenticatedState": "ambiguous",
"primary": true
}
]
},
"web": {
"webPageDetails": {
"URL": "https://alloystore.dev",
"name": "Home Page"
},
"webReferrer": {
"URL": ""
}
},
"device": {
"screenHeight": 1440,
"screenWidth": 3440,
"screenOrientation": "landscape"
},
"environment": {
"type": "browser",
"browserDetails": {
"viewportWidth": 3440,
"viewportHeight": 1440
}
},
"placeContext": {
"localTime": "2022-03-22T22:45:21.193-06:00",
"localTimezoneOffset": 360
},
"timestamp": "2022-03-23T04:45:21.193Z",
"implementationDetails": {
"name": "https://ns.adobe.com/experience/alloy/reactor",
"version": "1.0",
"environment": "serverapi"
},
"data": {
"__adobe": {
"target": {
"profile.eyeColor": "brown",
"profile.hairColor": "brown",
"profile.shoeColor": "black"
}
}
}
}
},
"query": {
"personalization": {
"schemas": [
"https://ns.adobe.com/personalization/html-content-item",
"https://ns.adobe.com/personalization/json-content-item",
"https://ns.adobe.com/personalization/redirect-item",
"https://ns.adobe.com/personalization/dom-action"
],
"decisionScopes": [
"serverapimbox"
]
}
}
}'
回應 response
Edge Network會傳回類似下列的回應。
{
"requestId":"10959bbf-f83d-40e1-9521-d9145f19cdc5",
"handle":[
{
"payload":[
{
"id":"AT:eyJhY3Rpdml0eUlkIjoiMTQwMjgxIiwiZXhwZXJpZW5jZUlkIjoiMCJ9",
"scope":"serverapimbox",
"scopeDetails":{
"decisionProvider":"TGT",
"activity":{
"id":"140281"
},
"experience":{
"id":"0"
},
"strategies":[
{
"algorithmID":"0",
"trafficType":"0"
}
],
"characteristics":{
"eventToken":"xycjBJlZhwVV5MN0kMkmoGqipfsIHvVzTQxHolz2IpTMromRrB5ztP5VMxjHbs7c6qPG9UF4rvQTJZniWgqbOw=="
}
},
"items":[
{
"id":"282484",
"schema":"https://ns.adobe.com/personalization/json-content-item",
"meta":{
"offer.name":"/server_apiform/experiences/0/pages/0/zones/0/1648103551041",
"experience.id":"0",
"activity.name":"Server API Form",
"activity.id":"140281",
"experience.name":"Experience A",
"option.id":"2",
"offer.id":"282484"
},
"data":{
"id":"282484",
"format":"application/json",
"content":{
"value":"a/b json experience a",
"platform":"server"
}
}
}
]
}
],
"type":"personalization:decisions",
"eventIndex":0
},
{
"payload":[
{
"key":"kndctr_53A16ACB5CC1D3760A495C99_AdobeOrg_identity",
"value":"CiYwNTkwNzYzODExMjkyNDQ4NDI0MTAyOTA4MjQwNTI5NzE1MTc2M1IOCL-pwpv9LxgBKgNPUjLwAb-pwpv9Lw==",
"maxAge":34128000
}
],
"type":"state:store"
}
]
}
如果訪客根據傳送至Adobe Target的資料符合個人化活動的資格,則相關活動內容會位於 handle
物件,其中型別為 personalization:decisions
.
其他內容有時會傳回到 handle
以及。 其他內容型別與Target個人化無關。 如果訪客符合多個活動的資格,則每個活動會是個別 personalization
物件。
下表說明該部分回應的主要元素。
scope
"scope": "serverapimbox"
items[].schema
"schema": "https://ns.adobe.com/personalization/json-content-item",
items[].meta.activity.id
"activity.id": "140281"
items[].meta.activity.name
"activity.name": "Server API Form"
items[].meta.experience.id
"experience.id": "0"
items[].meta.experience.name
"experience.name": "Experience A"
items[].data.id
"id": "282484"
items[].data.format
"format: "application/json
items[].data.content
"content": "<CONTENT CONFIGURED IN TARGET>"
伺服器端個人化範例應用程式 sample
範例應用程式發現於 此URL 示範如何使用Adobe Experience Platform從Adobe Target取得個人化內容。 網頁會根據傳回的個人化內容而變更。
這個範例會 非 仰賴使用者端資料庫,例如 Web SDK 以取得個人化內容。 而是使用Adobe Experience Platform API來擷取個人化內容。 然後實作會根據傳回的個人化內容在伺服器端產生HTML。