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
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Doubt about targetPageParams and Ajax

txemam26262263
Level 2
Level 2

Hi,

I am stuck in a specific scenario where I need to pass some parameters from AEM to Target. The problem is that those parameters are populated after an Ajax call, and I can't find the way to pass them. As they are only populated after Ajax success, I think that the only way those parameters will be populated is calling the function targetPageParams after the success.

I tried defining a function that contains targetPageParams, and calling it in the Ajax success event. My TargetPageParams function stopped working then (even thought it was working perfectly fine before the change). The parameters won't even appear in the Adobe Marketing Cloud Debugger. 

Is there any way to make this work?

Thanks in advance

1 Accepted Solution
akashj80621328
Correct answer by
Level 2
Level 2

Please clarify when is your Ajax event fired? If it is triggered inside body, then it won't be able to set mbox parameters in targetPageParams() method which is inside head tag and consequently, mbox call with not have these params.

Try using mboxUpdate in your callback method of Ajax call.

Hope that helps.

View solution in original post

5 Replies
akashj80621328
Level 2
Level 2

Thanks for reaching out to Adobe community

You could use an mboxUpdate() call after your Ajax success event. Format of mboxUpdate is like : 

mboxUpdate('<mbox name>','param1=value1','param2=value2',...);
Jon_Tehero
Employee
Employee

You may also want to try using TNT.createGlobalMbox() if you are using the targetPageParams() function. See details at the bottom of this article: https://marketing.adobe.com/resources/help/en_US/target/ov/c_mbox_technical.html

txemam26262263
Level 2
Level 2

Thanks for the idea, I have tried that before, but it's not working with my current configuration. I'm using a default target-global-mbox, with the auto-create global mbox option set as "true". I call targetPageParams() in my header along with the mbox.js call.

Should I set "mboxDefine()" and "mboxUpdate"? Or should it work only adding "mboxupdate('target-global-mbox','param1_balue1','param2=value2',...); into the Ajax success event?

Thanks

akashj80621328
Correct answer by
Level 2
Level 2

Please clarify when is your Ajax event fired? If it is triggered inside body, then it won't be able to set mbox parameters in targetPageParams() method which is inside head tag and consequently, mbox call with not have these params.

Try using mboxUpdate in your callback method of Ajax call.

Hope that helps.

View solution in original post

ParitMittal
Level 10
Level 10

Hi , 

Can you please let us know whether the problem is solved or not ?. If not, Please let us know so that we can further look into the issue .

Thanks & Regards

Parit Mittal