Integrate Tealium with Amplitude
This article is a guide to setting up and using Amplitude's Tealium integration.
There are two ways customers can send data to Amplitude:
- Tealium iQ & Tag Management (TIQ)
- Tealium AudienceStream & Universal Data Hub (Tealium sends data from TIQ to Amplitude)
Tealium iQ and tag management (TIQ)¶
Set up the integration¶
To integrate Tealium with Amplitude, follow these steps:
- In your Tealium workspace, create a data layer for your application. This is where you define the variables you need. (See the next section for more details.)
- Next, create a project for your data on Amplitude. This generates an API key for you.
- In the Tags tab in Tealium, add Amplitude. You can input the Amplitude API key in the tag configuration. You can also create load rules and data mappings here.
In your app, paste the snippet after the opening
Make sure all variables you're adding to your instrumentation code have been defined in the Data Layer tab. Then, add an Amplitude vendor tag for any events you want to track. Tags can't have multiple variables mapped to the same destination; to send multiple events from the same page load, configure separate vendor tags for each. The destinations represent the different forms of data that you can send to Amplitude:
The data layer¶
Tealium iQ uses data layers, which are a spec of the data that flow from a company's digital products and identifies events containing certain event attributes. After you define the data layer, you can install it across all your digital products and use that data for tag vendor configurations like Amplitude. The data layer is vendor-neutral, so you can instrument a data layer and then send it to many different vendor tags.
Include every data layer variable on your app in the Data Layer tab.
In the data layer, you can define the following variable types:
- Querystring Parameters: This captures parameters from the URL. For example, if the URL is
http://example.com/path/file.html?sortOrder=price, the variable name in Tealium is
- First-Party Cookies: Reference value in a cookie being set on your domain. When creating a cookie variable, you can either specify Tealium cookie,
utag_main, or standard cookie. You can also add your own custom values to the
utag_main cookie. The
utag.jslibrary creates and maintains a single cookie called
utag_main; within it are several built-in values that keep track of the visitor session.
ses_id: Unique identifier for the session.
_st: Unix/epoch time stamp in milliseconds.
v_id: Unique identifier for each visitor.
_ss: Boolean that indicates if the page viewed is the first in a session. A value of 1 means yes and 0 means no.
_pn: Number of pages viewed during the current session.
_sn: The number of sessions for this visitor.
- Meta Data Elements: Reference content of a meta tag in the page.
- AudienceStream Attributes: Attributes such as badges, metrics, and properties that are defined in AudienceStream, which takes data that flows into Tealium's other product (Universal Data Hub) and creates visitor profiles representing the most important attributes of user engagement.
Load rules are conditions that define when and where to load a tag. They consist of logical conditions that must pass before Amplitude loads a tag. For example, you can set it up so that only certain tags load on certain domains. You can use AND/OR logic or time/date-based conditions to load tags.
You can delete load rules when they're no longer useful to you, or just deactivate them if you think you might use them again in the future.
- Amplitude library and Device ID:
Library = 'amplitude-js'.
You can update UDO values outside of the declaration block as long as the variable is set prior to loading
utag.js. Otherwise, it's ignored. Here is a UDO on the initial page load:
To trigger another event when users click a button on the page and increment the
button_countervariable by one each time:.
You can configure the different SDK settings by mapping variables to the available destinations.