getOffer() applyOffer() - convert to SDK function | Community
Skip to main content
November 8, 2024
Solved

getOffer() applyOffer() - convert to SDK function

  • November 8, 2024
  • 1 reply
  • 496 views

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-personalization-content

Thanks in advance!

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

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. 

 

1 reply

Gokul_Agiwal
Community Advisor
Gokul_AgiwalCommunity AdvisorAccepted solution
Community Advisor
December 8, 2024

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.