Install
Learn to install Tealium Collect for Google Tag Manager.
Requirements
How it Works
The Tealium Collect Tag for Google Tag Manager is a custom template that loads the Tealium Collect JavaScript file from Tealium once per page.
For each tag triggered event, the tag automatically flattens the dataLayer
object into key-value pairs and posts the data to Tealium’s data collection endpoint. A custom endpoint may be used if you use first-party data collection.
The following Google Tag Manager event is prior to being flattened:
dataLayer.push({
'ecommerce': {
'purchase': {
'actionField': {
'id': 'T12345',
...
After being flattened, it becomes the following Tealium event:
"tealium_event": "purchase"
"ecommerce.purchase.actionField.id": "T12345"
...
Install
To add the Tealium Collect Tag via Google Tag Manager:
- In Google Tag Manager, click Templates in the left navigation.
- On the Tag Templates screen, click Search Gallery.
- Search for and select “Tealium Collect Tag”.
- Add the template by clicking Add to workspace.
- On the “Are you sure you want to add a community template?” screen, click Add
Add New Tag
To add an instance of the Tealium Collect Tag:
- In Google Tag Manager, click Tags in the left navigation.
- Click the New button.
- Click “Tag Configuration” to choose a tag type. Search and select “Tealium Collect Tag” from the list.
- Provide a name for the tag to replace the text “Untitled Tag”.
After adding the Tag, configure the following settings. Leave optional fields blank if the value is unknown.
- Tealium Account (required): The Tealium account name. For example,
companyXYZ
. - Tealium Profile (required): The Tealium profile name. For example,
main
. - Tealium Data Source Key (optional): The data source key from your server-side Tealium configuration. For example,
abc123
. - Data Collection Endpoint (optional): Override the Tealium Collect endpoint with your first-party data collection endpoint. For example,
https://collect.example.co.uk/example-event-endpoint
. - Data Object (optional): The custom JavaScript variable to use instead of the global
dataLayer
object. For example,{{myObject}}
.
Triggers
For page view tracking, use the built-in “All Pages” trigger. To include event tracking, use an “All Events” trigger to fire for all events.
To set up the “All Events” trigger in Google Tag Manager:
- In Google Tag Manager, click the Triggers in the left navigation.
- Click the New button to add a trigger.
- Click “Trigger Configuration” to choose a tag type. Search and select “Custom Event” from the list.
- Select the “Use regex matching” checkbox.
- Enter the following for the “Event Name” regular expression (regex):
^(?!gtm.load)(?!gtm.dom)(?!gtm.init)(?!gtm.init_consent).*
- Click Save, rename the custom trigger a new name, and click Save again.
This rule triggers for all events excepting gtm.load
and gtm.dom
(two events specific to Google Tag Manager that we want to ignore).
Data Layer Enrichment
The Tealium Data Layer Enrichment tag brings server-side attributes from Tealium AudienceStream and injects them into the data layer.
To install the Data Layer Enrichment tag:
- In Google Tag Manager, click Templates in the left navigation.
- On the Tag Templates screen, click Search Gallery.
- Search for and select “Tealium Data Enrichment Tag”.
- Add the template by clicking Add to workspace.
- On the “Are you sure you want to add a community template?” screen, click Add
Validation
If the Tealium Collect tag is firing for all events, then every dataLayer.push
call on your page sends a data collection event to Tealium.
In your debug console Network tab, a POST call goes out to https://collect.tealiumiq.com/ACCOUNT/PROFILE/2/i.gif
.
Use Live Events to see your event data in real-time.
This page was last updated: March 8, 2023