Data Layer
Google Tag Manager events are flattened to Tealium attribute names in order to meet the Tealium Customer Data Hub specifications. The event data is received by Tealium EventStream.
The value of tealium_event
is the value of the event
in the dataLayer.push
call. Google Tag Manager sets the default page view value to gtm.js
as the name of the event. To override the default, set the Tealium Event config setting to a variable that contains the event name.
Attributes are not automatically added. You must add these attributes in Tealium EventStream.
E-Commerce
The following purchase event example shows how the client-side e-commerce events get flattened.
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': 'T12345', // Transaction ID. Required for purchases and refunds.
'affiliation': 'Online Store',
'revenue': '35.43',
'tax':'4.90',
'shipping': '5.99',
'coupon': 'SUMMER_SALE'
},
'products': [{
'name': 'Triblend Android T-Shirt', // Name or ID is required.
'id': '12345',
'price': '15.25',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Gray',
'quantity': 1,
'coupon': ''
},
{
'name': 'Donut Friday Scented T-Shirt',
'id': '67890',
'price': '33.75',
'brand': 'Google',
'category': 'Apparel',
'variant': 'Black',
'quantity': 1
}]
}
}
});
After flattening, the purchase event becomes:
"ecommerce.purchase.actionField.affiliation": "Online Store"
"ecommerce.purchase.actionField.coupon": "SUMMER_SALE"
"ecommerce.purchase.actionField.id": "T12345"
"ecommerce.purchase.actionField.revenue": "35.43"
"ecommerce.purchase.actionField.shipping": "5.99"
"ecommerce.purchase.actionField.tax": "4.90"
"ecommerce.purchase.products.brand": [ "Google", "Google" ]
"ecommerce.purchase.products.category": [ "Apparel", "Apparel" ]
"ecommerce.purchase.products.coupon": [ "", "" ]
"ecommerce.purchase.products.id": [ "12345", "67890" ]
"ecommerce.purchase.products.name": [ "Triblend Android T-Shirt", "Donut Friday Scented T-Shirt" ]
"ecommerce.purchase.products.price": [ "15.25", "33.75" ]
"ecommerce.purchase.products.variant": [ "Gray", "Black" ]
"ecommerce.purchase.products.quantity": [ "1", "1" ]
The flattener uses dot notation to create the key, and the value is set to an array of all values from the purchase event.
Events
The following dataLayer.push
command fires when “event” is included in the data layer:
window.dataLayer.push({
event: "test_number",
type_number: 5,
type_string: 'hello',
type_object: { someKey: 'someValue' },
type_array: [1,2,3,4],
type_function: function() { return 'hello'; },
type_boolean: true
});
The data layer that arrives in Tealium EventStream looks as follows. Only the type_object
is flattened and the function is removed.
{
"event": "test_number",
"type_number": 5,
"type_string": "hello",
"type_object.someKey": "someValue",
"type_array": [1, 2, 3, 4],
"type_boolean": true
}