contextData in DTM




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.


Accepted Solutions (1)

Accepted Solutions (1)





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]

Answers (1)

Answers (1)




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 ( with as much detail as possible, including the URL(s) where you are testing, the company/property/rule(s) involved, etc?