Tealium iQ — Load Rules and Extensions

Brian Johnson
4 min readDec 8, 2021
Camping Sunrise
Camping Sunrise

Tealium iQ’s (TiQ) load rules offer simple-yet-robust conditional logic in a no-code user interface. They make it easy to combine ANDs and ORs across any combination of conditions you can imagine.

Want to build a load rule based on the combination of hostname AND pathname? Easy.

How about a specific query parameter value? No problem.

What about combining both of the above with an OR conditional? Can do. Maybe you want them combined as an AND? TiQ’s got you covered.

Once your load rules are in place, using them to control when (or if) a tag fires is as simple as editing the tag, locating the rule(s) on the “Load Rules” tab, specifying whether all selected load rules must pass or if any will do and saving the changes.

That’s it. Easy.

If you want to leverage your load rules in or with an extension, however… Well, that’s not quite as easy.

Consider the following:

  • You have a Doubleclick tag that fires on affiliate landing pages
  • You have a second Doubleclick tag that fires on any page with a “src” URL parameter with a value starting with “sup_”
  • Besides the above conditions, the only difference between the two tags is the “activity” parameter value
  • You want to use a lookup extension to assign the “activity” value

In the above scenario — which is relatively simple on the surface — it would be nice to leverage the exact same load rules to both allow the tag to fire and to set the “activity” value. Unfortunately, while the load rules are easily added to the tag, they can’t be used with an extension.

What do you do?

Create separate tags? Sure, but in a complex implementation, this could lead to an excessive number of tags that could/should be consolidated for easier maintenance. Short of recreating the logic with JavaScript, what are the options?

Replicate the load rule in an extension using JavaScript? Maybe, but what happens when the load rules change? You’re going to have to remember to update any/all extensions where this logic has been used. Maintenance will be a nightmare.

How about this option…

Using TiQ’s utag.cond object, check to see which relevant load rules have passed. Those that have passed, indicating that assigned tags will fire are assigned a value of 1, while all others are assigned a value of 0. In the example below, you’ll see that the load rule with UIDs* 12 and 18 did not pass but load rules 15 and 29 did:

utag.cond = {
"12": 0, // this load rule did not pass
"15": 1, // this load rule did pass
"18": 0, // this load rule did not pass
"29": 1 // this load rule did pass
}

Keeping with the Doubleclick scenario above, we can create a simple tag-scoped JavaScript extension to dynamically populate the “activity” parameter (or any parameter, for that matter) based on what utag.cond tells us. The benefit is that we’re able to reference existing load rule logic without having to replicate or recreate the logic elsewhere. Changes to the load rules automatically take effect with no additional extension updates required.

The code sample below illustrates how this might be accomplished:

Example usage of the utag.cond object
Example usage of the utag.cond object

About the Code

  1. Learn about TiQ’s b object
  2. Each of the four “dcm_” data layer variables has been added as a UDO Variable type in the TiQ Data Layer interface
  3. Lines 9 and 18 check to see if the specified load rules (based on UID) have passed. If they’ve passed, the appropriate values are assigned to the “dcm_” data layer variables. (Note: It is possible in this scenario that both rules will pass, and I’m expecting that.)
  4. The Doubleclick tag template accepts multiple event parameters and will generate separate network requests for each parameter passed. I’m taking advantage of that here so both activity events (xyz_001 and xyz_002) can fire if both load rules pass.
  5. Because the Doubleclick tag template accepts either a string or an array for the mapped variables referenced, I’ve chosen to use an array for simplicity of using .push(). To support this, lines 1–5 assign an empty array to each variable.

Some Considerations

  1. Not all tag templates support multiple events. Put another way, not all tag templates will trigger separate network requests like this example will. Doubleclick is just an example of one that does.
  2. The utag.cond object lists the status of all available load rules. All that have passed are assigned a value of 1. This adds complexity when a tag expects different parameter values for different load rules, but multiple load rules have passed. You have to decide which load rule “wins” and assign a value accordingly. (Or, set up separate tags, etc.)

*Note: The UID for all Tealium assets (Tags, Load Rules, Extensions) can be found to the right of the asset name in the TiQ interface.

--

--