How to use data from another data layer (not utag)

Silver Contributor
Silver Contributor

Hello there,

I am trying to harvest a third party data layer values and am wondering what would be the best way. Can I just populate the javascript variable with window.dataLayer.value.value? Or would I be better off using extension? What is the best practice?

Thank you.

3 REPLIES 3

How to use data from another data layer (not utag)

Tealium Employee

If you can have the data directly in your data layer, that would be best. However, there might be timing issues with when the "dataLayer" object is populated vs when Tealium reads the data layer and pulls in the values for the JS variables. You would need to ensure the values from the "dataLayer" object are populated BEFORE Tealium runs. If you can't guarantee that, the next best option would be to use an extension and pull it into the "b" object when utag.js is executing. 

Jen Kaye
Senior Premium Success Engineer | Tealium, Inc.

How to use data from another data layer (not utag)

Silver Contributor
Silver Contributor

Hello Jennifer.

Thank you for your help. You are indeed right, the third party datalayer is not ready in time for me to pull the data into utag. I am currently running tag scoped set values extension where I am pulling third party data into the data layer, however the data is then not available on page view, only on additional interactions like adding to basket etc. Could you please expand on how can I pull the third party data into the b object at a time of execution?

Kind regards,

Lu

How to use data from another data layer (not utag)

Tealium Employee

You can use a Set Data Values extension to pull in the values from "dataLayer" and set them to a variable in the "b" object. It would be set up as follows:

In the first drop down, select the UDO variable you want to set the value to.

In the second drop down, select "JS Code".

In the input box, type in the reference to the variable from the "dataLayer" object (ex: dataLayer[1])

You may want to keep in mind the timing here as well. If you have this extension scoped to all tags and you're running Google through Tealium, the tag might not have executed when the extension runs. You may need to do some trial and error with the scope and placement to ensure it works for the timing of your Google setup.

Jen Kaye
Senior Premium Success Engineer | Tealium, Inc.
Public