Edit in GitHubLog an issue

Get Offers


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



The TargetClient.getOffers method signature is shown as follows.

Copied to your clipboard
TargetDeliveryResponse TargetClient.getOffers(TargetDeliveryRequest request)

TargetDeliveryRequest is created using TargetDeliveryRequest.builder.

Copied to your clipboard
TargetDeliveryRequestBuilder TargetDeliveryRequest.builder()


The TargetDeliveryRequestBuilder object has the following structure:

contextContextYesSpecifies the context for the request
thirdPartyIdStringNoYour company’s identifier for the user that you can send with every call
cookiesListNoList of cookies returned in previous Target request of same user.
customerIdsMapNoCustomer Ids in VisitorId-compatible format
executeExecuteRequestNoPageLoad or mboxes request to execute. Will be evaluated on server side immediately
prefetchPrefetchRequestNoViews, PageLoad or mboxes request to prefetch. Returns with notification token to be returned on conversion.
notificationsListNoUsed to sent notifications regarding what prefetched content was displayed
requestIdStringNoThe request ID that will be returned in the response. Generated automatically if not present.
impressionIdStringNoIf present, second and subsequent requests with the same id will not increment impressions to activities/metrics. Generated automatically if not present.
environmentIdLongNoValid client environment id. If not specified host will be determined base on the provided host.
propertyPropertyNoSpecifies the at_property via the token field. It can be used to control the scope for the delivery.
traceTraceNoEnables trace for Delivery API.
qaModeQAModeNoUse this object to enable the QA mode in the request.
locationHintStringNoTarget edge cluster location hint. Used to target given edge cluster for this request.
visitorVisitorNoUsed to provide custom Visitor API object.
idVisitorIdNoObject that contains the identifiers for the visitor. Eg. tntId, thirdParyId, mcId, customerIds.
experienceCloudExperienceCloudNoSpecifies integrations with Audience Manager and Analytics. Automatically populated using cookies, if not provided.
tntIdStringNoPrimary identifier in Target for a user. Fetched from targetCookies. Auto-generated if not provided.
mcIdStringNoUsed to merge and share data between different Adobe solutions(ECID). Fetched from targetCookies. Auto-generated if not provided.
trackingServerStringNoThe Adobe Analytics Server in order for Adobe Target and Adobe Analytics to correctly stitch the data together.
trackingServerSecureStringNoThe Adobe Analytics Secure Server in order for Adobe Target and Adobe Analytics to correctly stitch the data together.
decisioningMethodDecisioningMethodNoCan be used to explicitly set ON_DEVICE or HYBRID decisioning method for on-device decisioning

The values of each field should conform to Target View Delivery API request specification. To learn more about the Target View Delivery API, see http://developers.adobetarget.com/api/#view-delivery-overview


The TargetDeliveryResponse returned by TargetClient.getOffers() has the following structure:

requestTargetDeliveryRequest​Target View Delivery API request
responseDeliveryResponseTarget View Delivery API response
cookiesListList of session metadata for this user. Need to be passed in next target request for this user.
visitorStateMapVisitor state to be set on client side to be used by Visitor API
responseStatusResponseStatusAn object representing the status of the response

The ResponseStatus in the response contains the following fields:

statusintHTTP status returned from Target
messageStringStatus message in case HTTP status is not 200
remoteMboxesList of StringsUsed for on-device decisioning. Contains a list of mboxes that have remote activities that cannot be decided entirely on-device.
remoteViewsList of StringsUsed for on-device decisioning. Contains a list of views that have remote activities that cannot be decided entirely on-device.

The TargetCookie object used for saving data for user session has the following structure:

nameStringCookie name
valueStringCookie value, the value will be converted to string
maxAgeNumberThe maxAge option is a convenience for setting expires relative to the current time in seconds

You don't have to worry about expiring the cookies. Target handles maxAge inside the SDK.


Copied to your clipboard
1ClientConfig clientConfig = ClientConfig.builder()
2 .client("acmeclient")
3 .organizationId("1234567890@AdobeOrg")
4 .build();
6TargetClient targetJavaClient = TargetClient.create(clientConfig);
8List<MboxRequest> mboxRequests = new ArrayList<>();
9mboxRequests.add((MboxRequest) new MboxRequest().name("a1-serverside-ab").index(1));
11TargetDeliveryRequest targetDeliveryRequest = TargetDeliveryRequest.builder()
12 .context(new Context().channel(ChannelType.WEB))
13 .execute(new ExecuteRequest().setMboxes(mboxRequests))
14 .build();
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.