۶Ƶ

mboxCreate(mbox,params) - at.js 1.x

Executes a request and applies the offer to the closest DIV with mboxDefault class name.

NOTE
This function is available for at.js versions 1.x only. This function was deprecated with the release of at.js 2.x. This function returns default content if used with at.js 2.x.

This function is built into at.js mostly to ease the transition from mbox.js (now deprecated) to at.js. A newer alternative to mboxCreate() is adobe.target.getOffer()/ adobe.target.applyOffer() or the Angular directive.

Example

<div class="mboxDefault">
  default content to replace by offer
</div>
<script>
  mboxCreate('mboxName','param1=value1','param2=value2');
</script>

Notes

mboxCreate() now uses the “json” endpoint instead of the “standard” endpoint and fires asynchronously. Because of this:

  • Debugging is a little different.

  • Avoid offer code requiring synchronous, blocking calls.

    For example, offers that set JavaScript variables that are used by site code or other mboxes that come later on the page.

  • Be sure to have a <div class="mboxDefault"></div>before invoking mboxCreate(), because at.js will not add one for you.

  • Empty, top-of-page mboxCreate() functions are not recommended as a global mbox.

    The auto-created global mbox in at.js is a better option because it fires from the <head> and can return content earlier.

recommendation-more-help
6906415f-169c-422b-89d3-7118e147c4e3