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

contextData in DTM

time42580181
Level 3
Level 3

Hi

We have a number of sites that use s.contextData on the page and we use the s_code to pick up the value and write it into props and evars etc.  Some are also using processing rules as well.

Using DTM and AppMeasurement.js we're unable to get contextdata to work.  We have a block of code on the page as follows:

<script type="text/javascript"> if(s){ s.contextData["page"] = "product.category"; } </script>

It seems to be getting re-initialised when the DTM code actually loads and we're therefore unable to use it.  Is this correct?  Does DTM and AppMeasurement still support contextData in this manner?

Any advise would be appreciated.

Thanks
Tim

1 Accepted Solution
Ben_Bytheway
Correct answer by
Employee
Employee

@Tim

Have you put a breakpoint in your code and verified that the code is being reached?

My two thoughts are:

1) Your script tag above is placed before your DTM container in the <head> and your s object is created.  So, your condition if (s) evaluates to false, and no context data is added to your s object.

2) Your code is in fact lower than your DTM container, but is being run before your tool because your tool is set to fire at pagebottom or somewhere after that.  

You can always put that javascript snippet in the "Custom Page Code" section in your tool and this will ensure that it will be run after your s object is initialized:

 

[img]DTM - Custom Page Code.PNG[/img]

View solution in original post

2 Replies
Ben_Bytheway
Correct answer by
Employee
Employee

@Tim

Have you put a breakpoint in your code and verified that the code is being reached?

My two thoughts are:

1) Your script tag above is placed before your DTM container in the <head> and your s object is created.  So, your condition if (s) evaluates to false, and no context data is added to your s object.

2) Your code is in fact lower than your DTM container, but is being run before your tool because your tool is set to fire at pagebottom or somewhere after that.  

You can always put that javascript snippet in the "Custom Page Code" section in your tool and this will ensure that it will be run after your s object is initialized:

 

[img]DTM - Custom Page Code.PNG[/img]

View solution in original post

shawncreed1
Level 3
Level 3

Tim,

DTM doesn't do anything that would reset/re-initialize contextData, and Appmeasurement still supports it as far as I know.

This is a situation where it would be helpful for us to get some additional information so we can investigate further and see what might be going on. Can you please e-mail Adobe ClientCare (clientcare@adobe.com) with as much detail as possible, including the URL(s) where you are testing, the company/property/rule(s) involved, etc?

Best,
Shawn