Data Layer Object (b)

Learn to use the alias to the Data Layer Object (b).

What is the b Object?

The b object is a JavaScript variable containing the most recent copy of the data layer object. Depending on when it’s referenced, the b object is either an alias or a local copy of the object. So what is the object? The object is a collection of all the data on your page:

  • Data Layer Variables
  • JavaScript Page Variables
  • Meta Tags
  • DOM Attributes
  • Cookies

So, in essence, the b object is a copy of your page’s data layer.

Why Do We Have a b Object?

Using the b object provides a couple benefits:

  • As an alias with a shorter name
    This shorter name improves performance loading Tealium. If you had to reference a hundred times, then you are adding 900 characters to the size of your files. That’s 900 more characters the browser has to parse through when loading these files which results in a negative affect on visitor load times. Referring to it as b means only 1 character to add to the file for each reference, which if you referenced a hundred times results in only 100 characters for the browser to parse through.
  • As a copy that leaves the original untouched
    By creating a local copy of, the values needed for each tag are customizable without affecting the original data object.

Variable Types

To reference a variable in the b object directly in a tag template or extension, you must consider the type of variable you’re trying to reference; the syntax differs slightly.

Data Layer

For variables contained in the utag_data object, use the following syntax:


JavaScript Page Variable

To reference variables defined as JavaScript Page variables, use the following syntax:


Query String Parameters

To reference a query string parameter, use the following syntax:


Tealium has two ways to store cookie values. The syntax to reference these two types varies slightly. Learn more about working with cookies in Tealium iQ.

  1. utag_main Cookie Values - to reference a cookie value contained in the utag_main cookie, use the following syntax:

  2. Standard Cookie Values - to reference a cookie value that is not contained in the utag_main cookie, use the following syntax:


Additional Considerations

The b object is not global

  • The b object is a locally scoped variable, only available in All Tags and Tag Scoped extensions.
  • Extensions scoped to Pre Loader run before the b object has been created.
  • Extensions scoped to DOM Ready run independently from the main order of operations, so the b object cannot be referenced in this scope either.
  • Learn more about how to reference the data object variable in extensions.

The b object in tracking calls

  • During a standard page load, the b object becomes a copy of the utag_data object. However, on manual tracking calls, the b object is a copy of the object passed to utag.view() or and does not contain variables from the original utag_data object.
  • To preserve data from utag_data in tracking calls (per page load) use the Base Variables setting in the publish settings.

For profiles loading version 4.39 or older, the content of the b object during tracking calls is a complete copy of Learn more about this update in release history utag.js 4.40.

Was this page helpful?

This page was last updated: January 7, 2023