Edit in GitHubLog an issue

Get Offers

Description#

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

Method#

Copied to your clipboard
TargetClient.getOffers(options: Object): Promise

Parameters#

The options object has the following structure:

NameTypeRequiredDefaultDescription
RequestObjectYesNoneConforms to the Target Delivery API request
visitorCookieStringNoNoneECID (VisitorId) cookie
targetCookieStringNoNoneTarget cookie
targetLocationHintStringNoNoneTarget location hint
consumerIdStingNoNoneconsumerIds for Analytics for Target (A4T) stitching
CustomerIdsArrayNoNoneCustomer IDs in VisitorId-compatible format
sessionIdStringNoNoneUsed for linking multiple Target requests
visitorObjectNonew VisitorIdSupply an external VisitorId instance

Promise#

Promise returned has the following structure:

NameTypeDescription
requestObjectTarget Delivery API request
responseObjectTarget Delivery API response
visitorStateObjectObject that should be passed to Visitor API getInstance()
targetCookieObjectTarget cookie
targetLocationHintCookieObjectTarget location hint cookie
analyticsDetailsArrayAnalytics payload, in case of client-side Analytics usage
responseTokensArrayA list of Response tokens.
traceArrayAggregated trace data for all request mboxes/views
statusObjectAn object containing the status of the response.
decisioningMethodStringDetermines which decisioning method to use (on-device, server-side, hybrid)

targetCookie and targetLocationHintCookie objects used for passing data back to the browser have the following structure:

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

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

NameTypeDescription
statusNumberHTTP status code
messageStringA message about the response. For instance, it may indicate if the response was decided on-device or server-side
remoteMboxesArrayWhen 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.

Example#

Copied to your clipboard
1const TargetClient = require("@adobe/target-nodejs-sdk");
2const CONFIG = {
3 client: "acmeclient",
4 organizationId: "1234567890@AdobeOrg"
5};
6
7const targetClient = TargetClient.create(CONFIG);
8
9const request = {
10 context: {channel: "web"},
11 execute: {
12 mboxes: [{
13 name: "a1-serverside-ab",
14 index: 1
15 }]
16}};
17
18const response = await targetClient.getOffers({ request });
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell my personal information
  • AdChoices
Copyright © 2022 Adobe. All rights reserved.