Page Tracking

Page Tracking

by Community Manager ‎09-28-2016 10:23 AM - edited ‎05-02-2018 01:51 PM (25,736 Views)

This guide explains how to track page views using utag.view() . Page view tracking gathers information about the navigation path a visitor takes. Each time a web page is loaded or the main content of the screen is changed, a page view should be tracked.

The default installation of utag.js will automatically track page views on the DOM-ready event.

Table of Contents Placeholder

utag.view()

This method tracks page views, virtual page views, and other AJAX page flows. Calling this method will trigger the corresponding page tracking functionality within your configured vendor tags.

Things to note:

  • utag.js automatically triggers this method on every page load.
  • Commonly used for AJAX page flows where the URL does not refresh as the user navigates the site eg. single-page checkout or single-page application.
  • The 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]);
data_object
Object, optional
The data object containing the attributes associated with this
specific tracking call. Uses the same format and variable names as
the Universal Data Object.

callback
Function, optional

A function to be executed after the tracking call has completed.
uid_array
Array, optional
An array of tag IDs. Will limit the tracking call for the vendor tags specified by the
UID's in this array.

Example of a "Product Quick View" tracking call, with a callback function, and only tracked by tags "34" and "12":

utag.view({
    "tealium_event": "product_view",
"page_type" : "product_quick_view", "page_name" : "Quick View: Shirts: Lucky Shirt", "product_id" : ["12345"], "product_name" : ["Lucky Shirt"] }, function() { utag.DB("Product Quick View has been tracked"); }, [34, 12] );

Single Page Applications

On single page applications where the page loads utag.js only once per visit, you will suppress the automatic page view tracking call to allow your application to make these calls directly.

To override the automatic page tracking add this line to your page prior to loading utag.js: 

window.utag_cfg_ovrd = {noview : true}; 

Once your application is loaded (and utag.js is loaded) you can trigger utag.view() tracking calls in your page code. These calls would typically be triggered at the DOM-ready event or any event that causes a content view refresh.

Read about more useful settings in utag_cfg_ovrd.

  • The utag_data object declared on initial page landing is not re-purposed with these calls. If data from the initial page landing needs to be used it will need to be re-declared and passed again in the method call.
  • As of utag.js version 4.36 or later, utag.link calls will load in tags not already on the page.
  • As of utag.js version 4.26, load rules are re-evaluated for both utag.view and utag.link calls. Note: a utag.link call will not bring in a new tag (one that isn't already loaded from initial page load), whereas a utag.view call will.
  • For utag.js versions prior to 4.26, load rules are not executed again during manual utag.view() or utag.link() calls. This means only the tags loaded on the initial page landing are available to be executed. For example, if SiteCatalyst and DoubleClick are the only two tags to run on page landing, these will be the only two tags available to respond to the utag tracking calls.
  • Global and Tag-scoped Extensions are executed during these calls. Pre-loader and DOM Ready extensions will not executed during these calls.