取得選件(Python)
說明
get_offers()
用於執行決定並從Adobe Target擷取體驗。
方法
getOffers
target_client_instance.get_offers(options)
參數
options
dict具有下列結構:
名稱
類型
必要
預設值
說明
target_cookie
str
no
無
Target Cookie
target_location_hint
str
no
無
Target位置提示
consumer_id
str
no
無
拼接多個呼叫時,應提供不同的消費者ID
customer_ids
清單[CustomerId]
no
無
VisitorId相容格式的客戶ID清單
session_id
str
no
無
用於連結多個請求
callBack
可呼叫
no
無
如果以非同步方式處理請求,則會在回應就緒時叫用回呼
err_callback
可呼叫
no
無
如果以非同步方式處理請求,則會在引發例外狀況時叫用錯誤回呼
傳回值
如果同步呼叫(預設),則傳回TargetDeliveryResponse
,如果以回撥呼叫,則傳回AsyncResult
。 TargetDeliveryResponse
具有以下結構:
名稱
類型
說明
target_cookie
dict
Target Cookie
target_location_hint_cookie
dict
Target位置提示Cookie
analytics_details
清單[AnalyticsResponse]
使用者端Analytics使用狀況下的Analytics裝載
trace
清單[dict]
所有請求mbox/檢視的彙總追蹤資料
meta
dict
用於裝置上決策的其他決策中繼資料
用來將資料傳回瀏覽器的target_cookie
和target_location_hint_cookie
物件具有以下結構:
名稱
類型
說明
名稱
str
Cookie 名稱
value
any
Cookie值,該值將會轉換為字串
max_age
int
max_age option
方便您設定相對於目前時間(以秒為單位)的過期時間用於表示目標回應狀態的meta
物件具有下列結構:
名稱
類型
說明
decisioning_method
str
使用的決策方法:裝置上或伺服器端
範例
Python
def client_ready_callback():
context = Context(channel=ChannelType.WEB)
mboxes = [MboxRequest(name="a1-serverside-ab", index=1)]
execute = ExecuteRequest(mboxes=mboxes)
delivery_request = DeliveryRequest(context=context, execute=execute)
get_offers_options = {
"request": delivery_request
}
target_delivery_response = target_client.get_offers(get_offers_options)
client_options = {
"client": "acmeclient",
"organization_id": "1234567890@AdobeOrg",
"events": {
"client_ready": client_ready_callback
}
}
target_client = TargetClient.create(client_options)
recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3