Edit in GitHubLog an issue

Get Offers

Description#

get_offers() is used to execute a decision and retrieve an experience from Adobe Target.

Method#

Copied to your clipboard
target_client_instance.get_offers(options)

Parameters#

The options dict has the following structure:

NameTypeRequiredDefaultDescription
requestDeliveryRequestYesNoneConforms to the Target Delivery API request
target_cookiestrnoNoneTarget cookie
target_location_hintstrnoNoneTarget location hint
consumer_idstrnoNoneWhen stitching multiple calls, different consumer IDs should be provided
customer_idslist[CustomerId]noNoneA list of Customer Ids in VisitorId-compatible format
session_idstrnoNoneUsed for linking multiple requests
callbackcallablenoNoneIf handling request asynchronously, the callback is invoked when response is ready
err_callbackcallablenoNoneIf handling request asynchronously, error callback is invoked when exception is raised

Returns#

Returns a TargetDeliveryResponse if called synchronously (default), or an AsyncResult if called with a callback. TargetDeliveryResponse has the following structure:

NameTypeDescription
responseDeliveryResponseConforms to the Target Delivery API response
target_cookiedictTarget cookie
target_location_hint_cookiedictTarget location hint cookie
analytics_detailslist[AnalyticsResponse]Analytics payload, in case of client side Analytics usage
tracelist[dict]Aggregated trace data for all request mboxes/views
response_tokenslist[dict]A list of ​Response Tokens
metadictAdditional decisioning metadata for use with on-device-decisioning

target_cookie and target_location_hint_cookie objects used for passing data back to the browser have the following structure:

NameTypeDescription
namestrCookie name
valueanyCookie value, the value will be converted to string
max_ageintThe max_age option is a convenience for setting expires relative to the current time in seconds

The meta object used for indicating the status of the target response has the following structure:

NameTypeDescription
decisioning_methodstrWhich decisioning method was used: on-device or server-side
remote_mboxeslist[str]When decisioning Method is on-device, an array of mbox names that could not be fully decided on-device is given. In other words, a Target Delivery API request is needed.
remote_viewslist[str]When decisioning Method is on-device, an array of view names that could not be fully decided on-device is given. In other words, a Target Delivery API request is needed.

Example#

Copied to your clipboard
1def client_ready_callback():
2 context = Context(channel=ChannelType.WEB)
3 mboxes = [MboxRequest(name="a1-serverside-ab", index=1)]
4 execute = ExecuteRequest(mboxes=mboxes)
5 delivery_request = DeliveryRequest(context=context, execute=execute)
6
7 get_offers_options = {
8 "request": delivery_request
9 }
10
11 target_delivery_response = target_client.get_offers(get_offers_options)
12
13
14client_options = {
15 "client": "acmeclient",
16 "organization_id": "1234567890@AdobeOrg",
17 "events": {
18 "client_ready": client_ready_callback
19 }
20}
21target_client = TargetClient.create(client_options)
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.