Please help me with a sample function that can be used for custom handling function. For example if I want to introduce a new button, how should I write the function using the below code and introduce the button in the offer?
adobe.target.getOffer({
"mbox": "target-global-mbox",
"success": function(offer) {
YOUR_OWN_CUSTOM_HANDLING_FUNCTION(offer);
},
"error": function(status, error) {
console.log('Error', status, error);
},
"timeout": 2000
});
Solved! Go to Solution.
Views
Replies
Total Likes
At a basic level you'll get an array of objects in the offer parameter that's available on success. If it's activities created via VEC, this could contain multiple different modifications (i.e. change button colour, add custom code etc etc) from one or more Target activities. So you'd need logic to parse through that offer array.
With activities created by the Form Composer, it would be more simple because you could define different mbox names for different locations e.g., an mbox called "homepage-hero-button" and then have multiple different experiences (with different audience logic applied) defined in a single activity.
So if the JSON offer from Target includes buttonColour & buttonText
I can then use that to change my button that has a class of ".w3-button"
Of course in reality you would have some logic to check that the offer array isn't empty, that it contains a content array that isn't empty, the buttonColour property exists etc
At a basic level you'll get an array of objects in the offer parameter that's available on success. If it's activities created via VEC, this could contain multiple different modifications (i.e. change button colour, add custom code etc etc) from one or more Target activities. So you'd need logic to parse through that offer array.
With activities created by the Form Composer, it would be more simple because you could define different mbox names for different locations e.g., an mbox called "homepage-hero-button" and then have multiple different experiences (with different audience logic applied) defined in a single activity.
So if the JSON offer from Target includes buttonColour & buttonText
I can then use that to change my button that has a class of ".w3-button"
Of course in reality you would have some logic to check that the offer array isn't empty, that it contains a content array that isn't empty, the buttonColour property exists etc