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
BedrockMission!

Learn More

View all

Sign in to view all badges

How do I retrieve content using applyOffers()?

Avatar

Avatar
Validate 1
Level 1
dan_e1982
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
dan_e1982
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
dan_e1982
Level 1

20-04-2021

Hi

I have a secure SPA that we're implementing Target into.  We've decided to utilise the new getOffers() and applyOffers() functions that were part of at.js 2x.

Via a Launch rule we have managed to successfully 'get' the offers, i.e., see the offers associated with the mbox in the response, this is code we've used to do this..

dan_e1982_0-1618984850574.png

However, I've been unable to figure out how to apply any of these offers, the Adobe documentation is a bit sparse, giving no example of how to retrieve the content associated with the mbox, I've attempted the below, which haven't retrieved anything:

 

dan_e1982_1-1618985227080.png

 

 

 

 

 

 

 

 

 

 

 

 

 

Is anybody able to give me any pointers, or examples of the correct syntax I should be using?

Many thanks

Dan

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 1
dan_e1982
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
dan_e1982
Level 1

Likes

0 likes

Total Posts

3 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Affirm 1
View profile
dan_e1982
Level 1

01-05-2021

I have managed to answer my own question.

 

First of all I run the getOffers() code, however I save the response into a custom Launch variable "resObj", this allows me to split the running of getOffers() and applyOffers()

 

dan_e1982_0-1619935296386.png

 

To apply the content within this "resObj", I run a for loop to find the mbox content I want to apply.   To easier facilitate this the mbox name I've applied in Target matches the analytics page name ("page|name").

 

mboxOffer then has the specific content of the mbox parsed into it, which can then be placed with the applyOffers() call

 

dan_e1982_1-1619935727044.png

This solution enables me to split the two functions, and refer directly to the response offer, something I've not been able to find in the Target documentation.

 

Hope this is useful to anybody else attempting to do this, I'd be interested to know whether anybody else in the community has come up with an alternative way to do this.

 

Dan

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 6
rush_pawan
Level 6

Likes

79 likes

Total Posts

156 posts

Correct Reply

63 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile

Avatar
Validate 1
Level 6
rush_pawan
Level 6

Likes

79 likes

Total Posts

156 posts

Correct Reply

63 solutions
Top badges earned
Validate 1
Ignite 1
Give Back 5
Give Back 3
Give Back 10
View profile
rush_pawan
Level 6

23-04-2021

Hello,

Is there any specific reason you are trying to execute applyOffer separately?? because ideally it should be working with getOffer after receiving the response. I hope you must have referred https://experienceleague.adobe.com/docs/target/using/implement-target/client-side/at-js-implementati... or https://experienceleague.adobe.com/docs/target/using/implement-target/client-side/at-js-implementati... 

 

based on at.js (1.x or 2.x) respectively.

 

and if you are using mbox.js then i think applyOffer doesn't supported there, refer - https://experienceleague.adobe.com/docs/target/using/implement-target/client-side/mbox-implement/mbo...