utag_data and utag.data

yan_almeida
Visitor
yan_almeida

What's the diference between utag_data and utag.data?

Thanks!

4 REPLIES 4

utag_data and utag.data

UnknownJ
Occasional Contributor
UnknownJ Occasional Contributor

It depends...

If window.utag_data exists prior to utag.js being loaded (as per best practice) then there is no difference between them - utag.data is initialised as a reference to window.utag_data and consequently changes to either are reflected in the other. The code that does that is here:

utag.data = (typeof utag_data != 'undefined') ? utag_data : {};

If window.utag_data is initialised after utag.js is loaded, it gets a bit trickier.. There is a function (utag.loader.WQ) that merges the contents into utag.data, but in that case it's only copies of the data item rather than a direct reference, and I forget now under which circumstances it fires. Suffice it to say, your experience of Tealium will be more straightforward if utag_data is always initialised before loading utag.js.

Highlighted

utag_data and utag.data

BenStephenson
Contributor
BenStephenson Contributor

Hi @yan_almeida

Additionally to what @UnknownJ says:

utag_data is (usually) declared on the page, and (usually) contains stuff set by the developers from the server

utag.data is the processed data layer. 

This contains everything from utag_data...
plus any DOM stuff (properties prefixed with "dom." such as utag.data["dom.url"])
plus any cookie values (properties prefixed with "cp.")
plus any page JS variables you may have declared
plus any querystring parameters (properties prefixed with "qp.")

Also utag.data will have had any extension manipulation code applied

Checkout our blog: www.120feet.com/blog

utag_data and utag.data

yan_almeida
Visitor
yan_almeida

Thank you!

utag_data and utag.data

yan_almeida
Visitor
yan_almeida

Thank you, Ben!