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

SOLVED

Deploying multiple Target mboxes to set profile parameters and recommendations data

philipk92120636
Level 4
Level 4

Hi everyone!

We're in the process of deploying Target using Adobe Launch. The suggested method in the documentation of loading the library at the top of the page and setting all the profile parameters and recommendations data at the same time is not suitable as the values aren't always available at the top of the page. For instance, profile parameters are populated by data layer values which aren't there until the DOM is ready and for recommendations data, the site needs to query a database to deliver the latest price.

In DTM we used custom code that fired after the page load (using getOffer and applyOffer code) to set the profile and recommendations data, but this method now causes the 'global mbox is not allowed in mboxes' error. Firing another 'Add params to page load request' rule doesn't work either because it causes the mbox SDIDs to not match which messes up Analytics for Target reporting.

I've been told by Client Care that there should only be one Target call on the page but looking at other sites I can see this isn't the case with a number of calls being made to Target. They're sometimes mboxes with different names but I can't see a way to add another mbox via Launch with a different name that we could use to deploy tests to as in Target there can only be one specified global-mbox.

I can't imagine that I'm the only person who has had this challenge and it's stressing me out. We need to be able to set all our profile parameters and then deliver the necessary content, whilst ensuring it doesn't mess with our Analytics for Target integration.

Any help or advice would be greatly appreciated.

launch mbox profile Recommendations Target
1 Accepted Solution
philipk92120636
Correct answer by
Level 4
Level 4

Managed to achieve this using the adobe.target.getOffers() and adobe.target.applyOffers methods in the at.js 2.0 API.

Code example:

 

// Set up object to send parameters into Target
var paramsObj = {
    "profile":{
// Key-value pairs for profile parameters
    },
    "global" : {
// Key-value pairs for other parameters
    }
};

adobe.target.getOffers({
    request: {
      "execute" : {
        "pageLoad" : {
          "parameters" : paramsObj.global,
          "profileParameters" : paramsObj.profile
          }
      },
      "experienceCloud": {
        "analytics": {
          "supplementalDataId" : _satellite.getVar("sdid") // Data element containing last SDID value
        }
      }
    }
})

// Apply any offers based on parameters
.then(function(response){
    adobe.target.applyOffers ({
      response: response
      })
    })
}

 

View solution in original post

5 Replies
Andrey_Osadchuk
Community Advisor
Community Advisor

Hi Philip,

 

Could you elaborate on what happens when you Load Target on Library Loaded and Add Parameters with Fire Global Mbox on DOM Ready?

 

Could you share the custom code you are referring to?

philipk92120636
Level 4
Level 4
Hi Andrey! So I got this working (kind of). I split my Target rules into a library loaded rule that fires the pre-hiding snippet and then loads the Target library. I have a second DOM ready rule that sets the parameters and fires the global mbox. This achieved basically what I wanted (one mbox request per page with the profile parameters), however, the pre-hiding snippet (which I had to add to prevent flicker) means that the page is blank until the DOM is ready.
Andrey_Osadchuk
Community Advisor
Community Advisor

Philip,

 

Just in case, the pre-hiding snippet should be hardcoded in the HTML code, it should not be added via Launch.

 

The page may remain blank unless Target returns the offer or the timeout is triggered.

philipk92120636
Correct answer by
Level 4
Level 4

Managed to achieve this using the adobe.target.getOffers() and adobe.target.applyOffers methods in the at.js 2.0 API.

Code example:

 

// Set up object to send parameters into Target
var paramsObj = {
    "profile":{
// Key-value pairs for profile parameters
    },
    "global" : {
// Key-value pairs for other parameters
    }
};

adobe.target.getOffers({
    request: {
      "execute" : {
        "pageLoad" : {
          "parameters" : paramsObj.global,
          "profileParameters" : paramsObj.profile
          }
      },
      "experienceCloud": {
        "analytics": {
          "supplementalDataId" : _satellite.getVar("sdid") // Data element containing last SDID value
        }
      }
    }
})

// Apply any offers based on parameters
.then(function(response){
    adobe.target.applyOffers ({
      response: response
      })
    })
}

 

View solution in original post