Expand my Community achievements bar.

SOLVED

How to pass param via DTM script

Avatar

Level 3

¸¸Hi,

I want to update my target-global-mbox via a dom ready/non sequential js but I'm not sure about the syntax.

Because of some race condition, I can't create a data element and use it like this

  • user.categoryId = <mydataElement>

I must call everything as low as possible in my page.

Unless someone have an idea how to get rid of the race condition, while using the standard data element call from a page load rule, I need to confirm if the right syntax to update the target-global-mbox really is like so:

mboxUpdate('target-global-mbox','user.categoryId=dummyValue');

Thanks a lot

-Eric

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Hi Eric,

If I understand correctly you'd like to pass categoryId information to Target. That information isn't available until the "bottom of the page". So you're not able to capture that value at the top of the page for the Target global mbox request.

Here's an option for sending information to Target from data layers, or variables that aren't present until the bottom of the page.

Create a page load rule in DTM. Run at bottom of page. Add a custom Javascript tag that fires a secondary call to Target with the user.categoryId info. Your data element should return a value at the bottom of the page, or you could directly reference the variable.

This is a sample for the script you can use:

adobe.target.trackEvent({mbox:'dataCapture', params:{'user.categoryId':_satellite.getVar(dataElementName)}});

View solution in original post

4 Replies

Avatar

Correct answer by
Employee Advisor

Hi Eric,

If I understand correctly you'd like to pass categoryId information to Target. That information isn't available until the "bottom of the page". So you're not able to capture that value at the top of the page for the Target global mbox request.

Here's an option for sending information to Target from data layers, or variables that aren't present until the bottom of the page.

Create a page load rule in DTM. Run at bottom of page. Add a custom Javascript tag that fires a secondary call to Target with the user.categoryId info. Your data element should return a value at the bottom of the page, or you could directly reference the variable.

This is a sample for the script you can use:

adobe.target.trackEvent({mbox:'dataCapture', params:{'user.categoryId':_satellite.getVar(dataElementName)}});

Avatar

Level 3

Hi, in Adobe Experience Cloud Debugger, I'm assuming that it is normal now that for each page view I see two calls (one for target-global-mbox and one for datacapture).  Does this create an issue in terms of stats or in terms of first load behavior for a user?

But in network tab (".tt.") it's normal that in response I only see the sessionId?

Avatar

Employee Advisor

Yes that is expected an normal. Should be not issues with the secondary call. Any Target call that isn't part of an activity will only have a sessionid as the response.