contextData in DTM | Community
Skip to main content
Level 2
October 16, 2015
Solved

contextData in DTM

  • October 16, 2015
  • 2 replies
  • 2543 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by bbythewa

@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]

2 replies

bbythewaAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

@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]

shawncreed1
Level 3
October 16, 2015

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