DTM: Custom Page Code does not load properly
We are having some difficulties using the Custom Page Code for Adobe Analytics in a Page Load Rule.
The general setup is as follows:
- A fresh s_code is hosted with DTM (Managed).
- The Load order for this general Adobe Analytics tag is set to bottom, as its dependent on DOM elementets (tracking object = s).
Now we want to assign an action to a specific page, fx. a product view. For this we create a new Page Load Rule (Load Order = Bottom of page), and because DTM currently does not support the s.products in the UI, we are going to write the behavior in the Custom Page Code under the Adobe Analytics tab. However, the data assigned to the s object in this script, is not send with the pageView tracking - in fact, it is not visible at all. Using the predefined fields in the UI (eVar, prop events, etc.) data is perfectly send with the pageView tracking - the error only occurs using the Custom Page Code.
Using the debugger - _satellite.setDebug(true) - it seems like the Page Load Rule is handled first, and then the s object is overwritten with the general Analytics code afterwards?
We have also tried using "s=window.s", but it casts a undefined exception when accessing the s object. Experimenting with alert boxes etc. i can see the load order as:
- Page Load Rule for product views (set variables)
- Load Adobe Analytics tag (set variables)
- Track pageView
Have anyone else faced similar problems? When is the s object actually loaded and accessible?
Regards