Can we use nested variables in a datalayer?

Gold Contributor
Gold Contributor

We are looking to shift our tagging setup towards the W3C standard for new projects. This requires a different setup of our datalayer. It will look something like this:

window.universal_variable = {
"basket": {
"id": "BASKET2203",
"currency": "GBP",
"subtotal": 123.00,
"subtotal_include_tax": true,
"tax": 12.00,
"shipping_cost": 1.00,
"shipping_method": "Standard Mail",
"total": 123.00,
"line_items": [LineItem, LineItem, LineItem, ...]
}
}



Will these nested datalayers work with Tealium, in combination with the windows.universal_variable setup?

6 REPLIES 6

Can we use nested variables in a datalayer?

Employee Emeritus

Hi Martijn, first off there a couple of different standards for a data layer variable.

The example that you are quoting here is from Qubit's Universal Variable standard, which is documented at http://docs.qubitproducts.com/uv/

The W3C spec is called Digital Data, the site is http://www.w3.org/community/custexpdata/and the documentation for the object is at http://www.w3.org/2013/12/ceddl-201312.pdf

Of the two, Qubit's spec is simpler to read and currently much better documented. However it is also a vendor-specific format which may not necessarily be adopted by other vendors. The W3C format is an open specification and although it's significantly less readable it may gain more acceptance because it is maintained by W3C.

Tealium can support either format - we have a translation layer tool that reads the data object from the page and maps it to data layer variables in a format that Tealium can understand. In the case of nested product variables, we "unwrap" them into separate array variables that can be handled by the Ecommerce extension.

This is not yet available as a product feature in the UI, but if you make a request via your Account Manager we can help to install and configure the translation layer.

Can we use nested variables in a datalayer?

Gold Contributor
Gold Contributor

Hi Fiann,

Thanks for the explanation. It is good to know we can use nested variables with Tealium and that there are many types to choose from. Will make it easier for our developers.

You are referring to the ecommerce extension. Not all of the data we will be collecting is necessarily ecommerce data. It can be contextual data as well for the page. Will this work with other extensions, etc as well?

Can we use nested variables in a datalayer?

Employee Emeritus

None of the Tealium extensions are really designed to work well with nested objects, and the very long variable names / object references would make the mapping look very complex and confusing.

So the data layer will consist of two parts. First you have the data object on the page, which contains the nested variables. For example in W3 format the page name would be:
digitalData.page.pageInfo.pageName

The translation layer flattens this to non-nested variables in Tealium format, for example page_name.

You would see the flat names in the tag mapping table, and in the extension.

I hope that helps to clarify things a little.

Can we use nested variables in a datalayer?

Employee Emeritus

Martijn,

The best way to use a nested data layer is to have a custom extension built that flattens the nested object into a flat utag_data object, which is readable by Tealium by default. This extension should have the PreLoader scope, which will make the data available for Load Rules, extensions, etc.

Check out this post on the W3C data layer converter for reference:

 

https://community.tealiumiq.com/t5/Tealium-iQ/W3C-Data-Layer-Converter/ta-p/13265

Can we use nested variables in a datalayer?

Gold Contributor
Gold Contributor
Thanks Jared! It's bookmarked :)

Can we use nested variables in a datalayer?

Community Manager
Community Manager

Here is the most current solution for handling nested data layers: Data Layer Converter

Remember to "Accept as Solution" when your question has been answered and to give kudos to helpful replies.
Public