This section explains how to track page views using utag.view(). Page view tracking gathers information about the navigation path a visitor takes. A tracking call is made each time a web page is loaded or the main content of the screen is changed.
The default installation of utag.js automatically tracks page views on the DOM-ready event.
This method tracks page views, virtual page views, and other AJAX page flows. Calling this method triggers the corresponding page tracking functionality within your configured vendor tags. utag.js automatically triggers this method on every page load.
utag.js is commonly used for Ajax page flows where the URL does not refresh as the user navigates the site. For example, single-page checkout or single-page application.
The Universal Data Object (UDO) declared on the initial page load, utag_data, is not re-purposed with these calls. You must explicitly pass a new data object to this method.
Best practice is to use the variable tealium_event to identify important page view events and page_type to uniquely identify page templates.
utag.view(data_object, callback, [uid_array]);
(Optional) A data object containing the attributes associated with this specific tracking call. Uses the same format and variable names as the Universal Data Object.
(Optional) A function to be executed after the tracking call has completed.
(Optional) An array of tag IDs. Limits the tracking call for the vendor tags specified by the UID’s in this array.
The following example demonstrates a “Product Quick View” tracking call, with a callback function. It is only tracked by tags 34 and 12:
This section explains how to track events using utag.link(). Event tracking collects information about your visitors’ interactions within a page. While page view tracking gathers information about the navigation path a visitor takes, event tracking monitors what visitors do in-between navigation steps.
This method tracks non-page views, page interactions, and other dynamic events that might occur on a page. Calling this method triggers the corresponding vendor tracking functionality within your configured tags.
utag.link(data_object, callback, [uid_array]);
A data object containing the data layer variables associated with the event.
A function to be executed after the tracking call has completed.
An array of tag UID’s to trigger.
The following is an example of an “Add to Cart” event, without a callback function, tracked by all tags:
To uniquely identify each type of interaction to be tracked, use the reserved variable tealium_event. This variable is referenced throughout Tealium iQ to configure load rules, extensions, and data mappings. Use additional variables names of your choosing for all other event data.
The suggested tealium_event values include, but are not limited to:
Just as page view tracking requires a data layer object to give context about which page is being tracked, event tracking also requires a data layer object be included in the tracking calls. Include variables relevant to the event in the data object of the tracking call.
The following sections describe the approaches for implementing Tealium’s event tracking into your website.
jQuery and HTML5
Use the jQuery Extension to track basic interactions within a page, such as clicking, expanding, and selecting. Use HTML5 data attributes to implement informational properties of tracked elements. Requires a web page with semantic HTML.
Best used for link clicks, button clicks, form field interactions.
Not recommended for Ajax page flows, or form submissions.
An element with data attributes might look like this in the page code:
Reference these attributes in the jQuery Extension to track clicks on this link and to set the relevant event data using the “JS Code” option.
Use a selector to identify elements with a specific data attribute. For example, a[data-click_name].
Set a variable using the “JS Code” option to reference a data attribute in the clicked element. For example, $(this).data('click_name').
Used for tracking dynamic page content refreshes, Ajax pages, modal form submissions or any event that requires a round-trip request/response to the client’s web server to fetch additional data not already present on the page.
Best used for modal forms, product quick view, single page websites, add to cart from non-product pages.
Not recommended for link tracking.
Video tracking often requires a custom solution coding to the specifications of the video platform API.
Learn more about Tealium’s current solutions for YouTube video tracking.
Single Page applications
Learn about tracking views and events on sinlge page applications.