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

Learn more

View all

Sign in to view all badges

getOffer() code

Level 4
Level 4

Hi everyone!

Just looking for a step-by-step explanation of the getOffer() and applyOffer code.{   
  "mbox": "target-global-mbox", 
  "params": { 
     "a": 1, 
     "b": 2 
  "success": function(offer) {           {  
           "mbox": "target-global-mbox", 
           "offer": offer  
        } ); 
  "error": function(status, error) {           
      console.log('Error', status, error); 


I've read the help article here but I could do with some further information. My specific queries are:

  • What does the 'offer' refer to in the success function?
  • Does the code both set profile information as well as deliver content? 

My use case that has caused me to seek help is as follows:

  • I'm updating an Mbox parameter based on a data element change rule using DTM, firing the code above (but with actual Mbox parameters)
  • I'm then using this Mbox parameter to create an audience rule in Target
  • When this Mbox parameter changes to a specific value (and therefore the profile script) I want to deliver a specific Target Experience straight away

Basically, a customer answers a question and based on that answer I want to put them into an audience and change some content on the page at the same time.

What I want to understand is if the code above does all those things at once:

  1. Updates the profile parameter
  2. Evaluates what audience the customer falls into
  3. Delivers the appropriate on page content for that audience

Many thanks!

0 Replies