Expand my Community achievements bar.

SOLVED

Create an mbox with at.js 2.x

Avatar

Community Advisor

Hi Team,

 

mboxCreate method doesn't work with at.j.
How could we create an mbox div at page level?

I tried with below code but no luck :

 

<div class="mboxDefault">
adobe.target.getOffer({
"mbox": "customTestMbox",
"params": {
"status": "true"
},
"success": function(offer) {
adobe.target.applyOffer( {
"mbox": "customTestMbox",
"offer": offer
} );
},
"error": function(status, error) {
console.log('Error', status, error);
}
});
</div>

1 Accepted Solution

Avatar

Correct answer by
Employee
6 Replies

Avatar

Correct answer by
Employee

Hi @ambikaTewari_ATCI,

Try closing your <div> tag before the script. Please see https://docs.adobe.com/help/en/target/using/implement-target/client-side/upgrading-from-atjs-1x-to-a... for a sample.

 

Thanks!

Avatar

Community Advisor
Sure @surebee, But m getting error now as :index.html:826 Uncaught ReferenceError: adobe is not defined

Avatar

Community Advisor

Hi @surebee @Amelia_Waliany Target library is loaded async through launch so when the below code is getting executed the target is not loaded and hence m getting the error. I tried loading the below code  async also but that is not helping either. I need to fire target library async only. How could I fix it. Any inputs in this regard is highly appreciated.

 

<div class="mboxDefault">This is a test Mbox</div>

 

<script type="text/javascript" async>

adobe.target.trackEvent({

    "mbox": "orderConfirmPage",

    "params":{ 

        "orderId": transactionID, 

        "orderTotal": cartTotal

    }

});

</script>

Avatar

Community Advisor

Hi @surebee @amelia I was getting error Adobe not defined so I have fired the orderconfirmPage mbox via page load rule in launch. I can see this getting fired now.orderConfirmPage.png

Avatar

Administrator

Hi @ambikaTewari_ATCI

 
Our next Adobe Target Skill Builder Webinar is right around the corner on May 5th, and will be presented by Adobe Target Product Management on migrating Adobe Target’s mbox.js to At.js. Check out this community discussion to register today. Hope you can make it!
 
Warmly,
Amelia