utag.data does not include values I have added in data layer

Chipe
Rookie Contributor
Chipe

I am not sure how to properly ask this. Hopefully this makes sense. Very new to Tealium. Inside of iQ Tag Management I have added a Universal Data Object called sitetest_abcdefg. The type if UDO Vaiable. Then in Extensions I have one called "Grab Site Test Data" with the scope "All Tags - Before Load Rules" and in configuration I have the set as the UDO variable name and the "To" as "Js Code" which maps to my defined object on my site. 

I assume Tealium looks at this path I gave it to find the value from my site, and adds it to the utag.data object? However this is not happening. For some reason it is not persisting the data to this in "utag.data.someVarIDefine"

On my page I console log both "utag" and "utag.data". The odd thing is when I look at the "utag" object that is logged I drill down to utag.data and I do see my sitetest_abcdefg variable there with the correct value. However the very next line that console logs "utag.data" does not have my sitetest_abcdefg variable name or value. Why would it include my value within just logging "utag" but once "utag.data" is logged my variable is not included? What is happening here?

How I am trying to use this:

if (utag.data.sitetest_abcdefg === 'hijkl'){
// code for site this site test group
} else {
// code when not in site test group
}

but utag.data.sitetest_abcdefg is undefined, but that value shows up when just console logging "utag"

Hope this makes sense, or someone knows whats going on here

 

** Edited **

2 REPLIES 2

utag.data does not include values I have added in data layer

Tealium Employee

Hi Chipe,

There is a setting called Page Data Object in the publish settings. This enables you to tell utag.js that you are using a datalayer with a custom name. Have you used that setting?

https://community.tealiumiq.com/t5/iQ-Tag-Management/Publish-Configuration/ta-p/13632

Regards,

Thomas

utag.data does not include values I have added in data layer

Chipe
Rookie Contributor
Chipe
I added some test text in the Page Data Object field in the publish settings to see what it does and upon console logging utag I see it adds my text like so:

utag: {
...
udoname: "testDataObjTest"
...
}

Where testDataObjTest is what I added. This is how it shows up. So how can I use this to get the value of my added variable of "sitetest_abcdefg" which should hold a value? Do I added my variable name to the page data object field, and can use that somehow to get the value?