Expand my Community achievements bar.

Join us for an upcoming in-person Adobe Target Skill Builders event ~~> We're hosting these live learning opportunities to equip you with the knowledge and skills to leverage Target successfully. Learn more to see if we'll be coming to a city near you!

getOffers method not returning offers when Audience is added to Activity

Avatar

Level 2

We created an experience fragment in AEM and exported it to target in JSON format and created an activity in Target using the JSON xf. We use getOffers method as per adobe document in AEM using react in SPA to get the JSON data on webpage. https://experienceleague.adobe.com/en/docs/target-dev/developer/server-side/node-js/get-offers#:~:te... 

Without adding Audience to experience we are getting JSON on webpage. But when we add Audience to Experience, we are getting response but JSON xf(offer) is missing in JSON. Do we have to pass anymore parameters? We use the same code mentioned in document.

 

@alexbishop @Gokul_Agiwal @Ryan_Roberts_ @PratheepArunRaj @ambikaTewari_ATCI 

 

 

 

4 Replies

Avatar

Employee Advisor

Based on your description, you're not qualifying for the Audience you have applied. It might be that you need to pass some additional parameters but that depends on your audience. What is the Audience definition? 

If you do need to pass some additional parameters then you can refer to the Delivery API docs (the Node SDK makes use of the Delivery API) to see how to structure everything

Avatar

Level 2

Hi @alexbishop 

True, the logged in user is not qualifying for audience. Audience is created in AT with segment in AEP. We are sure that the user we used to login is present in audience in AT. We doubt that issue is we fail to pass userdetails in request. Below is the code we used to get offer.

 

const TargetClient = require("@adobe/target-nodejs-sdk");
const CONFIG = {
  client: "acmeclient",
  organizationId: "1234567890@AdobeOrg"
};

const targetClient = TargetClient.create(CONFIG);

const request = {
    context: {channel: "web"},
    execute: {
        mboxes: [{
            name: "a1-serverside-ab",
            index: 1
        }]
}};

const response = await targetClient.getOffers({ request });

Currently we are not passing any user information in API call. From this document we got that it should be passed as id in request. https://experienceleague.adobe.com/en/docs/target-dev/developer/api/delivery-api/identifying-visitor... 

But we are not clear on how to get marketingCloudVisitorId and integrationCode.

 

 

 

Avatar

Employee Advisor

Ok, one thing to be aware of is that same/next page personalisation isn't supported when you're not interacting with Target via the Web SDK/Edge Network. So even if the implementation is correct, it would be supporting next-session use cases due to audience qualification latency (more info here).

If you do want to utilise Edge segmentation & same/next page use cases, then this help doc talks through the different options available

Avatar

Level 2

Hi @alexbishop 

So cant we use @adobe/target-nodejs-sdk in React to connect to target and get response?