Support for qaMode in Node.js On-Device Decisioning? | Community
Skip to main content
ChrisRaser
Level 2
December 11, 2024
Question

Support for qaMode in Node.js On-Device Decisioning?

  • December 11, 2024
  • 1 reply
  • 1369 views

Hi all, 

 

The Node.js getOffers() method seems to be ignoring my QA parameters. 


The docs for Node.js getOffers() method indicate that it conforms to the spec for the REST-based Delivery API . 

My request object contains the request.qaMode value as described in the Delivery API spec.

 

const offers = targetClient.getOffers({
// ...
"request": {
//...
"qaMode": {
"token": "s_c15OYe-jBHIvKsmzAuL7zP_DDcGGb87aV06x_KWVo",
"listedActivitiesOnly": true,
"evaluateAsTrueAudienceIds": [],
"previewIndexes": [
{
"activityIndex": 1,
"experienceIndex": 2
}
]
},
// ...
});

However, getOffers() seems to be ignoring this. (I'm 100% sure it's correctly formatted, etc. - it's created & populated using the same code that's creating the qaMode object we pass to the Delivery API endpoint in production.)

Can anyone point me to any documentation on this? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Gokul_Agiwal
Community Advisor
Community Advisor
December 12, 2024

Hi @chrisraser 

Seems there is no mentioned about qaMode in documentation, however I can see same issues reported before on github repo. 

https://github.com/adobe/target-nodejs-sdk/issues/30

and I noticed one thing - in example they haven't used below parameter in qaMode object, though its there in type definition. 

evaluateAsTrueAudienceIds

in this thread, https://experienceleaguecommunities.adobe.com/t5/adobe-target-questions/php-and-adobe-target-delivery-api/m-p/635220 

one of our advisor @alexbishop also mentioned to use without "evaluateAsTrueAudienceIds" parameter ..  

It's actually only token & the previewIndexes array that are required within the qaMode object 

I'm unable to check as I'm working on client PC which bit restricted but will give a try, meantime can you please check and see if this is working for you? 

Hope this helps. 

 

 

 

ChrisRaser
Level 2
December 12, 2024

Thanks for the suggestion, Gokul!

I tried removing the evaluateAsTrueAudienceIds property, but the qaMode still has no effect.  I also took a look at that issue on github, but when I use the request JSON suggested there, I get no Offers at all. (The options property is empty.)

I'll continue digging through documentation, but so far I just don't see much info on how the various request parameters interact. Clearly something is causing the SDK to ignore the qaMode value, but I feel like I'm going to have to go read the full SDK source code to determine what.

I'm hoping that adding more detail here will give folks more to go on, so here's the full run-down.

Initializing the Target Client (Including the rules.json Artifact):

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
}
]
}
}
}
Gokul_Agiwal
Community Advisor
Community Advisor
January 3, 2025

Hi @chrisraser Happy 2025.

Just wondering - did you able to get through qaMode using Node JS. Any further update on this thread?

Thanks