Referring to variable defined in utag_data

Bronze Contributor
Bronze Contributor

Hi everyone,


Is there an easy way to refer to a variable in in a custom Tealium container? 


I have the following situation. On the site, I have variables defined in - one of which is a language, say: locale.

var utag_data = {
  "locale" : "EN"

I'm trying to access this variable in Tealium by using, but this seems not to be the right way. (Note that I'm used to working in Google Tag Manager, where you can normally access these variables by using window.dataLayer[0].yourVariable)


What would be the best way to access the value of the variables defined in utag_data? I read on the community forum that there's a variable 'b' that is a copy of all the variables defined in utag and the JS variables on the site. Could I alternatively use that?




Referring to variable defined in utag_data

Tealium Employee

Hi @dudetest (cool name by the way!) 


There are a number of different 'scopes' to the data object variables so you get utag_data,, and


This post explains the difference between utag_data, and, and if you are working in the tag tempate "library code" section, you would probably want to be using or['locale'] contains the data from the UDO and any additional data that has been mapped to the tag from the mapping interface. 


You are also likely to be working in the send function of the custom container. Under normal conditions you would be writing code after the mapping section so you would want to access the '' object. In this case you would most likely need to be referencing['locale'] or


If you still have trouble, log a ticket with support and they will be able to help you troubleshoot. 


Many thanks.


Connecting data systems since the 1980s.