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..
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:
Is anybody able to give me any pointers, or examples of the correct syntax I should be using?
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()
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
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.