Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards
SOLVED

getOffer() applyOffer() - convert to SDK function

Avatar

Level 1

Hi guys,

I'm trying to do the same as in at.js but in SDK with getOffer() and applyOffer() functions.

I need to reload the AT SDK library (interact) with all the experiences because one experience needs to reload the ‘view’ to launch another one. That is, in the first experience a profile parameter is launched, it must reload the same vita (i.e. reload AT) to be able to load the second experience.

 

This is the code I tried to do but it doesn't work:

 alloy("sendEvent", {
                "xdm": {},
                "decisionScopes": ["__view__"],
              })
                .then(function (result) {
                  var propositions = result.propositions;

                  var resultProposition;
                  if (propositions) {
                    for (var i = 0; i < propositions.length; i++) {
                      var proposition = propositions[i];
                      if (proposition.scope === "__view__") {
                        resultProposition = proposition;
                        break;
                      }
                    }
                  }

                  if (resultProposition) {
                    alloy("applyPropositions", {
                      propositions: [resultProposition],
                    });
                    console.log('apply');
                  }
                })
                .catch(function (error) {
                  console.error("Error processing the offer:", error);
                });

I am not clear about the information on:
https://experienceleague.adobe.com/en/docs/experience-platform/web-sdk/personalization/rendering-per...

Thanks in advance!

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @PatriciaEs3  Are you able to resolve this? 

If I understood correctly, then I think you are trying to achieve the first experience based on triggered profile parameter and then second experience will see .. means the "view" (or page ) re-load with updated offers based on the modified profile. 

Is this understanding correct?  

 

If this is correct then I would suggest below 

1) Send an event to update the profile parameter. 

2) Fetch updated decision using the sendEvent method. 

3) Apply updated decision using applyPropositions 

 

Hope this helps. 

 

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hi @PatriciaEs3  Are you able to resolve this? 

If I understood correctly, then I think you are trying to achieve the first experience based on triggered profile parameter and then second experience will see .. means the "view" (or page ) re-load with updated offers based on the modified profile. 

Is this understanding correct?  

 

If this is correct then I would suggest below 

1) Send an event to update the profile parameter. 

2) Fetch updated decision using the sendEvent method. 

3) Apply updated decision using applyPropositions 

 

Hope this helps.