Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Retrieving Target offers via alloy.js

Avatar

Level 4

Hello all,

 

Cracking more into our implementation of alloy.js with a goal of replacing all of the legacy Adobe libraries...

Right now we use at.js and make a call to getOffers() with some parameters to retrieve eligible activities/experiences. Then we call applyOffers() to  execute them.

 

I'm have a difficult time trying to get this to work via alloy.js. I've followed the instructions here to the letter, and even tried myriad combinations/changes, but I get empty decisions and propositions arrays every time.

https://experienceleague.adobe.com/docs/experience-platform/edge/personalization/adobe-target/target...

 

We don't use "views" as such... We simply have activities and experiences in Target, some with custom code, some via the VEC. Nothing particularly special. Also, there is an implication in the documentation that "decisionScopes" are synonymous with mboxes, but when I try to pass the global mbox name, I get an error stating that I shouldn't do that.

 

In the datastream configuration, Target is enabled and the client code and environment code are both set

 

 

Is there an alloy command and syntax that indeed parallels the getOffer()-applyOffer() functionality provided by at.js?

 

1 Accepted Solution

Avatar

Correct answer by
Level 4

And.... I just figured it out. I've been testing with a "dummy" A/B test that doesn't actually do anything. Both variations are simply default content.

 

When requested via getOffer() with at.js, Target does in fact select my Activity and deliver it (as seen in the responseTokens), however with alloy and 'sendEvent', nothing is returned. It isn't until I make the test actually do something, then I get the expected response.

 

I'm not sure if this is a bug or a feature, but figured I'd this here in case someone encounters the same debacle in their implementation

 

View solution in original post

4 Replies

Avatar

Correct answer by
Level 4

And.... I just figured it out. I've been testing with a "dummy" A/B test that doesn't actually do anything. Both variations are simply default content.

 

When requested via getOffer() with at.js, Target does in fact select my Activity and deliver it (as seen in the responseTokens), however with alloy and 'sendEvent', nothing is returned. It isn't until I make the test actually do something, then I get the expected response.

 

I'm not sure if this is a bug or a feature, but figured I'd this here in case someone encounters the same debacle in their implementation

 

Avatar

Level 4

Hi there, thank you for replying 🙂 

I am using 2.6.4, but this isn't so much an issue with Response Tokens but rather Activities with "empty" Experiences, or Experiences with no modifications (custom code or VEC, etc). We use such Experiences for our control groups or default content.

 

Using at.js, if I fall into one of those control or default content tests, the response from Target still has all of the response tokens, but of course there are no modifications in the response payload. This is expected behavior.

 

...But with alloy, in those cases, not only do I not get any "propositions" back, but the response tokens are absent as well... The response is basically empty--zero propositions.

 

Avatar

Level 2

Hi Team,

 

I had a quick question passing the mbox parameters while calling getOffers() earlier with alloy('sendEvent'{}) now, could you please take a look and suggest me if this correct or any changes. Thanks in advance.

 

adobe.target.getOffers({
  request: {
    "prefetch": {
      "mboxes": [
	     {
		  index: 0,
          name: "hero-container"
          "parameters": {
            "ad": "1"
          },
          "profileParameters": {
            "age": 23
          }
        },
		{
		  index: 1,
          name: "home-page-left-rail"
          "parameters": {
            "ad": "1"
          },
          "profileParameters": {
            "age": 23
          }
        }
      ]
    }
  }
});

 

alloy("sendEvent", {
  renderDecisions: true,
  decisionScopes: ["hero-container","home-page-left-rail"],
  data: {
    __adobe: {
      target: {
        "ad": "1",
		"profile.gender": "female",
        "profile.age": 23
      }
    }
  }
});