Expand my Community achievements bar.

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!

0 Replies