Load rules are conditions that define when and where to load a tag. This article provides information on adding and managing load rules.
In this article:
A load rule determines when a tag loads on your site or app. A load rule is one or more conditions that are based on the values in the data layer. For example, a load rule condition that identifies your search page might be:
page_type equals search
The default load rule is All Pages.
Multiple conditions can be combined using boolean logic to form more complex load rules. For example, to load a tag on the search page, but only when the user is not logged in, the load rule conditions might be:
page_type equals search AND is_logged_in equals 1
This complex logic can be combined into a single rule or created as two rules and then enforced using the Match All Rules setting.
Use AND logic to create a rule that is true only when all of the conditions evaluate to true. For example, a rule that combines 3 conditions using AND logic evaluates to true only if each individual condition also evaluates to true. If any of the conditions evaluate to false, then the entire rule also evaluates to false.
Use OR logic to create a rule that is true when any of the conditions evaluate to true. For example, a rule that combines 3 conditions using OR logic evaluates to true if any of the individual conditions also evaluate to true. A rule that uses OR logic only evaluates to false if all of the individual conditions also evaluate to false.
Each rule condition uses a comparison operator and a variable from the data layer. The following table lists the available comparison operators that can be used in load rule conditions. For operators that include
(ignore case) in the name, the text value of the variable is converted to lowercase before the comparison.
|Comparison Operator||When a tag loads on a page|
||The variable contains the specified sequence of characters.|
||The variable does not contain the specified sequence of characters.|
||The variable does not end with the specified sequence of characters.|
||The variable does not equal the specified value.|
||The variable does not start with the specified string of characters.|
||The variable does not end with the specified string of characters.|
||The variable equals the specified value.|
||The variable is greater than the specified value.|
||The variable is greater than or equal to the specified value.|
||The badge is assigned to the visitor.
For use with data layer enrichment.
||The badge is not assigned to the visitor.
For use with data layer enrichment.
||The variable is defined in the data layer.|
||The variable is not defined in the data layer.|
||The variable is defined in the data layer and is not blank or empty.|
||The variable is defined in the data layer and is blank or empty.|
||The variable is less than the specified value.|
||The variable is less than or equal to the specified value.|
||The variable matches the regular expression.|
||The variable begins with the specified sequence of characters.|
Load rules can be managed either from the Load Rules screen or from the expanded tag details screen.
In the list view, the Mapped column displays the number of tags scoped to the load rule. For example,
1/2 indicates that the load rule is assigned to 2 tags, but only 1 is active.
The UID column displays the numeric identifier for each load rule. This value can be useful when debugging utag.js.
Use the following steps to create a load rule:
To assign load rules to a tag, expand the tag details and click Edit in the load rules area.
You can also create, edit, copy, activate, deactivate, and delete load rules from the tag details area.
Select the checkbox next to the load rule that you want to scope to the tag.
If you select more than one load rule the following options are available to determine which boolean logic to apply to the selected load rules:
On the Load Rules screen, click a load rule to expand its details.
The Load Rule Configuration section displays the title and logical conditions of the rule.
The Tags section displays a list of the tags scoped to the load rule. To jump to a scoped tag, click the arrow next to the tag UID.
To add an optional label to a load rule, click Apply Labels, enter the label text, and click the arrow.
Labels can be used to organize and uniquely identify rules in your profile.
Deactivating a load rule turns it off, but keeps it in your profile for future use. When a load rule is deactivated, it remains in the profile and can be reactivated later.
To deactivate a load rule, go to the Load Rules screen, then click the ON toggle button of the load rule that you want to deactivate.
The toggle button changes to display OFF.
To reactivate a load rule, click the OFF toggle button.
You can delete a load rule to remove it from the profile. Deleting a load rule removes all instances of that load rule from the utag.js file.
Use the following steps to delete a load rule:
The following example shows a load rule to identify the checkout page of the site for a customer that is buying shoes. This example uses an AND condition, so the following two conditions must be met:
pathname contains checkout.html
product_category contains (ignore case) shoes
If both conditions are true, the load rule evaluates to true.
If any of the conditions in an AND statement are false, the load rule evaluates to false.
The following example uses an OR condition. This rule loads a tag on a page if the
checkout.html OR if the
shoes. If one of the statements is true, the rule evaluates to true. If all of the statements in an OR statement are false, the load rule evaluates to false.
The components of a URL can be useful when creating load rule conditions. A URL typically consists of the following components:
In the data layer, the components of a page URL are stored in DOM variables, as follows:
dom.domain : "www.tealium.com" dom.pathname : "/app/solutions/" dom.query_string : "example=test&example2=test2" dom.hash : "section3" dom.url : "http://www.tealium.com/app/solutions/?example=test&example2=test2#section3"
If a site consists of several domains, you may need to create a load rule to load tags for pages in a specific domain. The following example shows a load rule for pages in
To load tags on the homepage for
domain1.com, use the following rule:
To load tags on pages in the
support section of
domain1, use the following rule:
Pathname AND Hash, OR Querystring
To load tags for
support pages containing a section named
section2 or when there is a query string that contains
support=true, use the following rule:
You can use time-based conditions, which specify a date and time range, in a load rule along with one or more variable conditions. The date and time range specifies a time period in which the tag is loaded on pages.
Time-based conditions must be used with at least one variable condition, otherwise the load rule always evaluates to false.
Use the following steps to add a date range condition to a load rule.
Endfields to select the start and end dates.
The following special considerations may apply:
Endfields are empty, the default values
any timeare used.
##:## AM(or PM).
To use UTC time instead of the browser's local time, see Time-based Load Rule using UTC.