Is it possible to use the Code Editor for "Data Element" to query two different objects and return one value?
We moved from GTM to DTM a little over 6 weeks ago and I'm still getting to grips with its functions.
Scenario:
I need to capture the page name in a Data Element using a DTM script/property used over two different domains.
Domain 1 has a dataLayer, where I can use the standard 'JS Object' option to retrieve the page name e.g. digitalData.page.name
Domain 2 does not have a dataLayer and I have to use the CSS selector for where a business page name has been defined (not document.title) to retrieve the page name e.g. Data Element option is CSS Selector, #WebMIPageName and return 'other' value of 'content'
What I would like to know if there a way to write a piece of code using the code editor option in Data Elelment to look for both and return the page name?
e.g.
IF digitalData.page.name OR #WebMIPageName then return value or 'content'
As you can tell I have no code/java experience so I hope this makes sense..
Thanks for reading...