targetClient = TargetClient.create({
client: "acme",
organizationId: "A9733BC75245B1A30A490D4D@AdobeOrg",
property: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", // prod
decisioningMethod: "on-device",
events: { clientReady: startExpressApp },
artifactPayload: {
"version": "1.0.0",
"meta": {
"clientCode": "acme",
"environment": "staging"
},
"globalMbox": "target-global-mbox",
"geoTargetingEnabled": false,
"responseTokens": [
"activity.id",
"activity.name",
"experience.id",
"experience.name",
"offer.id",
"offer.name",
"profile.adobeQA",
"profile.geat1085_bbi",
"profile.geat1085_cid",
"profile.getBorderfreeCountry",
"profile.isSeabiscuit",
"profile.rand1to100"
],
"remoteMboxes": [
"Seabiscuit_Test",
"target-global-mbox"
],
"remoteViews": [],
"localMboxes": [
"Seabiscuit_Test_Pdp",
"Seabiscuit_Test_Plp",
"Seabiscuit_all_pages",
"abba_odd_research",
"server_side_plp",
"test_server_side",
"test_server_side_analytics",
"test_server_side_matt"
],
"localViews": [],
"rules": {
"mboxes": {
"test_server_side_odd": [
{
"ruleKey": "590584",
"activityId": 590584,
"meta": {
"activity.id": 590584,
"activity.name": "ODD_STRIPED_PDP_50-50_SPLIT",
"activity.type": "ab",
"experience.id": 0,
"experience.name": "Experience A",
"location.name": "test_server_side_odd",
"location.type": "mbox",
"location.id": 0,
"audience.ids": [],
"offer.id": 2127551,
"offer.name": "/odd_striped_pdp_50-50split/experiences/0/pages/0/zones/0/1733941108493",
"option.id": 2,
"option.name": "Offer2"
},
"condition": {
"and": [
{
"\u003C=": [0, {
"var": "allocation"
}
]
},
{
"\u003E=": [1, {
"var": "allocation"
}
]
}
]
},
"consequence": {
"name": "test_server_side_odd",
"options": [
{
"type": "json",
"eventToken": "cFJpfz+u9dHUNU9rkyalQ2qipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==",
"content": {
"ab": "pdpStripedBackground:false",
"experience": "A"
}
}
],
"metrics": []
},
"propertyTokens": [
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
]
},
{
"ruleKey": "590584",
"activityId": 590584,
"meta": {
"activity.id": 590584,
"activity.name": "ODD_STRIPED_PDP_50-50_SPLIT",
"activity.type": "ab",
"experience.id": 1,
"experience.name": "Experience B",
"location.name": "test_server_side_odd",
"location.type": "mbox",
"location.id": 0,
"audience.ids": [],
"offer.id": 2127552,
"offer.name": "/odd_striped_pdp_50-50split/experiences/1/pages/0/zones/0/1733941108531",
"option.id": 3,
"option.name": "Offer3"
},
"condition": {
"and": [
{
"\u003C": [1, {
"var": "allocation"
}
]
},
{
"\u003E=": [2, {
"var": "allocation"
}
]
}
]
},
"consequence": {
"name": "test_server_side_odd",
"options": [
{
"type": "json",
"eventToken": "cFJpfz+u9dHUNU9rkyalQ5NWHtnQtQrJfmRrQugEa2qCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==",
"content": {
"ab": "pdpStripedBackground:true",
"experience": "B"
}
}
],
"metrics": []
},
"propertyTokens": [
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
]
},
{
"ruleKey": "590584",
"activityId": 590584,
"meta": {
"activity.id": 590584,
"activity.name": "ODD_STRIPED_PDP_50-50_SPLIT",
"activity.type": "ab",
"experience.id": 2,
"experience.name": "Experience C",
"location.name": "test_server_side_odd",
"location.type": "mbox",
"location.id": 0,
"audience.ids": [],
"offer.id": 2129141,
"offer.name": "/odd_striped_pdp_50-50split/experiences/2/pages/0/zones/0/1734026672581",
"option.id": 4,
"option.name": "Offer4"
},
"condition": {
"and": [
{
"\u003C": [2, {
"var": "allocation"
}
]
},
{
"\u003E=": [100, {
"var": "allocation"
}
]
}
]
},
"consequence": {
"name": "test_server_side_odd",
"options": [
{
"type": "json",
"eventToken": "cFJpfz+u9dHUNU9rkyalQwreqXMfVUcUx0s/BHR5kCKCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==",
"content": {
"ab": "pdpStripedBackground:false",
"experience": "C"
}
}
],
"metrics": []
},
"propertyTokens": [
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
]
},
{
"ruleKey": "583168",
"activityId": 583168,
"meta": {
"activity.id": 583168,
"activity.name": "Matt AB Test Target Delivery API",
"activity.type": "ab",
"experience.id": 0,
"experience.name": "Control",
"location.name": "test_server_side_odd",
"location.type": "mbox",
"location.id": 0,
"audience.ids": [],
"offer.id": 2075351,
"offer.name": "/matt_ab_test_targetdeliveryapi/experiences/0/pages/0/zones/0/1729604726549",
"option.id": 2,
"option.name": "Offer2"
},
"condition": {
"and": [
{
"\u003C=": [0, {
"var": "allocation"
}
]
},
{
"\u003E=": [34, {
"var": "allocation"
}
]
}
]
},
"consequence": {
"name": "test_server_side_odd",
"options": [
{
"type": "json",
"eventToken": "1Kimq1NLhZPKdw19pi/3MWqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==",
"content": {
"pdp_redesign_2024_title": "control"
}
}
],
"metrics": []
},
"propertyTokens": [
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
]
},
{
"ruleKey": "583168",
"activityId": 583168,
"meta": {
"activity.id": 583168,
"activity.name": "Matt AB Test Target Delivery API",
"activity.type": "ab",
"experience.id": 1,
"experience.name": "Challenger A",
"location.name": "test_server_side_odd",
"location.type": "mbox",
"location.id": 0,
"audience.ids": [],
"offer.id": 2075352,
"offer.name": "/matt_ab_test_targetdeliveryapi/experiences/1/pages/0/zones/0/1729604726553",
"option.id": 3,
"option.name": "Offer3"
},
"condition": {
"and": [
{
"\u003C": [34, {
"var": "allocation"
}
]
},
{
"\u003E=": [67, {
"var": "allocation"
}
]
}
]
},
"consequence": {
"name": "test_server_side_odd",
"options": [
{
"type": "json",
"eventToken": "1Kimq1NLhZPKdw19pi/3MZNWHtnQtQrJfmRrQugEa2qCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==",
"content": {
"pdp_redesign_2024_title": "challengerA"
}
}
],
"metrics": []
},
"propertyTokens": [
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
]
},
{
"ruleKey": "583168",
"activityId": 583168,
"meta": {
"activity.id": 583168,
"activity.name": "Matt AB Test Target Delivery API",
"activity.type": "ab",
"experience.id": 2,
"experience.name": "Challenger B",
"location.name": "test_server_side_odd",
"location.type": "mbox",
"location.id": 0,
"audience.ids": [],
"offer.id": 2075350,
"offer.name": "/matt_ab_test_targetdeliveryapi/experiences/2/pages/0/zones/0/1729604726489",
"option.id": 4,
"option.name": "Offer4"
},
"condition": {
"and": [
{
"\u003C": [67, {
"var": "allocation"
}
]
},
{
"\u003E=": [100, {
"var": "allocation"
}
]
}
]
},
"consequence": {
"name": "test_server_side_odd",
"options": [
{
"type": "json",
"eventToken": "1Kimq1NLhZPKdw19pi/3MQreqXMfVUcUx0s/BHR5kCKCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==",
"content": {
"pdp_redesign_2024_title": "challengerB"
}
}
],
"metrics": []
},
"propertyTokens": [
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
]
}
],
"target-global-mbox": [
{
"ruleKey": "494148-0",
"activityId": 494148,
"meta": {
"activity.id": 494148,
"activity.name": "minh_test_vec",
"activity.type": "ab",
"experience.id": 0,
"experience.name": "Experience A",
"location.name": "target-global-mbox",
"location.type": "view",
"location.id": 0,
"audience.ids": [8381310],
"option.id": 0
},
"condition": {
"and": [
{
"and": [
{
"\u003C=": [0, {
"var": "allocation"
}
]
},
{
"\u003E=": [0, {
"var": "allocation"
}
]
}
]
},
{
"and": [
{
"==": [
"bfgp-001.ecm.acme.com",
{
"var": "page.domain"
}
]
},
{
"or": [
{
"==": [
"/on/demandware.store/Sites-US-Site/en_US/Cart-Show/",
{
"var": "page.path"
}
]
},
{
"==": [
"/on/demandware.store/Sites-US-Site/en_US/Cart-Show",
{
"var": "page.path"
}
]
}
]
}
]
}
]
},
"consequence": {
"name": "target-global-mbox",
"options": [
{
"eventToken": "BIBKq6v6RDg+ANCndw29eGqipfsIHvVzTQxHolz2IpSCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q=="
}
],
"metrics": []
},
"propertyTokens": [
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
]
},
{
"ruleKey": "494148-0",
"activityId": 494148,
"meta": {
"activity.id": 494148,
"activity.name": "minh_test_vec",
"activity.type": "ab",
"experience.id": 1,
"experience.name": "Experience B",
"location.name": "target-global-mbox",
"location.type": "view",
"location.id": 0,
"audience.ids": [8381310],
"option.id": 2,
"option.name": "Offer2"
},
"condition": {
"and": [
{
"and": [
{
"\u003C": [0, {
"var": "allocation"
}
]
},
{
"\u003E=": [100, {
"var": "allocation"
}
]
}
]
},
{
"and": [
{
"==": [
"bfgp-001.ecm.acme.com",
{
"var": "page.domain"
}
]
},
{
"or": [
{
"==": [
"/on/demandware.store/Sites-US-Site/en_US/Cart-Show/",
{
"var": "page.path"
}
]
},
{
"==": [
"/on/demandware.store/Sites-US-Site/en_US/Cart-Show",
{
"var": "page.path"
}
]
}
]
}
]
}
]
},
"consequence": {
"name": "target-global-mbox",
"options": [
{
"type": "actions",
"eventToken": "BIBKq6v6RDg+ANCndw29eJNWHtnQtQrJfmRrQugEa2qCnQ9Y9OaLL2gsdrWQTvE54PwSz67rmXWmSnkXpSSS2Q==",
"content": [
{
"type": "setHtml",
"selector": ".b-cart-page_title",
"cssSelector": "${cssSelector}",
"content": "Your shopping cart"
}
]
}
],
"metrics": []
},
"propertyTokens": [
"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
]
}
]
},
"views": {
}
}
}
});
Call to getOffers():
const response = await targetClient.getOffers({
request: {
"requestId": "4d5cf3f5a377423f9d9685bc3023124d",
"id": {
"marketingCloudVisitorId": "22263661887276736133741538669203887461"
},
"property": {
"token": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
},
"context": {
"channel": "web",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
},
"qaMode": {
"token": "s_c15OYe-jBHIvKsmzAuL7zP_DDcGGb87aV06x_KWVo",
"listedActivitiesOnly": true,
"previewIndexes": [
{
"activityIndex": 1,
"experienceIndex": 2
}
]
},
"experienceCloud": {
"analytics": {
"supplementalDataId": "770206E6CE89C763-0D3BAF90D32A930E",
"logging": "server_side"
}
},
"execute": {
"mboxes": [
{
"index": 0,
"name": "test_server_side_odd"
}
]
}
}
});
Response JSON:
{
"visitorState": {
"A9733BC75245B1A30A490D4D@AdobeOrg": {
"sdid": {
"supplementalDataIDCurrent": "3D6F8DE2EEDDCDE8-50A334FB833EF318",
"supplementalDataIDCurrentConsumed": {
"payload:target-global-mbox": true
},
"supplementalDataIDLastConsumed": {}
}
}
},
"request": {
"requestId": "4d5cf3f5a377423f9d9685bc3023124d",
"id": {
"marketingCloudVisitorId": "22263661887276736133741538669203887461"
},
"property": {
"token": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
},
"context": {
"channel": "web",
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"
},
"experienceCloud": {
"analytics": {
"supplementalDataId": "3D6F8DE2EEDDCDE8-50A334FB833EF318",
"logging": "server_side"
}
},
"execute": {
"mboxes": [
{
"index": 0,
"name": "test_server_side_odd"
}
]
},
"qaMode": {
"token": "s_c15OYe-jBHIvKsmzAuL7zP_DDcGGb87aV06x_KWVo",
"listedActivitiesOnly": true,
"previewIndexes": [
{
"activityIndex": 1,
"experienceIndex": 1
}
]
}
},
"targetCookie": {
"name": "mbox",
"value": "session#8456439511c54a259b4cf25402837cf3#1734043908",
"maxAge": 1861
},
"targetLocationHintCookie": {
"name": "mboxEdgeCluster",
"value": "35",
"maxAge": 1860
},
"responseTokens": [
{
"activity.id": 590584,
"activity.name": "ODD_STRIPED_PDP_50-50_SPLIT",
"experience.id": 2,
"experience.name": "Experience C",
"offer.id": 2129141,
"offer.name": "/odd_striped_pdp_50-50split/experiences/2/pages/0/zones/0/1734026672581",
"activity.decisioningMethod": "on-device"
}
],
"meta": {
"decisioningMethod": "on-device",
"remoteMboxes": [],
"remoteViews": []
},
"response": {
"status": 200,
"requestId": "4d5cf3f5a377423f9d9685bc3023124d",
"id": {
"marketingCloudVisitorId": "22263661887276736133741538669203887461"
},
"client": "acme",
"execute": {
"mboxes": [
{
"name": "test_server_side_odd",
"options": [
{
"type": "json",
"content": {
"ab": "pdpStripedBackground:false",
"experience": "C"
},
"responseTokens": {
"activity.id": 590584,
"activity.name": "ODD_STRIPED_PDP_50-50_SPLIT",
"experience.id": 2,
"experience.name": "Experience C",
"offer.id": 2129141,
"offer.name": "/odd_striped_pdp_50-50split/experiences/2/pages/0/zones/0/1734026672581",
"activity.decisioningMethod": "on-device"
}
}
],
"index": 0
}
]
}
}
}