- TLC Home Home
- Discussions & Ideas Discussions & Ideas
- Product Guides Product Guides
- Knowledge Base Knowledge Base
- Developer Docs Developer Docs
- Education Education
- Blog Blog
- Support Desk Support Desk
Load rules are conditions that define when and where to load a tag. Load rules can also be linked to consent and to the following extensions:
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 |
contains contains (ignore case)
|
The variable contains the specified sequence of characters. |
does not contain does not contain (ignore case) |
The variable does not contain the specified sequence of characters. |
does not end with does not end with (ignore case)
|
The variable does not end with the specified sequence of characters. |
does not equal does not equal (ignore case)
|
The variable does not equal the specified value. |
does not start with does not start with (ignore case)
|
The variable does not start with the specified string of characters. |
ends with ends with (ignore case)
|
The variable does not end with the specified string of characters. |
equals equals (ignore case)
|
The variable equals the specified value. |
greater than |
The variable is greater than the specified value. |
greater than or equal to |
The variable is greater than or equal to the specified value. |
is badge assigned |
The badge is assigned to the visitor. For use with data layer enrichment. |
is badge not assigned |
The badge is not assigned to the visitor. For use with data layer enrichment. |
is defined |
The variable is defined in the data layer. |
is not defined |
The variable is not defined in the data layer. |
is populated |
The variable is defined in the data layer and is not blank or empty. |
is not populated |
The variable is defined in the data layer and is blank or empty. |
less than |
The variable is less than the specified value. |
less than or equal to |
The variable is less than or equal to the specified value. |
regular expression |
The variable matches the regular expression. |
starts with starts with (ignore case)
|
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 on the Load Rules screen, shown below, the Used In column shows the number of tags that are using the load rule.
The UID column displays the numeric identifier for each load rule. This value can be useful when debugging utag.js.
The list of load rules is sorted by UID, in ascending order, by default. You can also sort the list of rules by Name, Date Modified, or Modified By by clicking the column heading.
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. The detailed rule screen is displayed.
The Configuration tab displays the title and logical conditions of the rule. The Tags tab displays a list of the tags scoped to the load rule. To go to a scoped tag, click the tag. The Consent tab displays information about consent that is linked to this rule.
Labels can be used to organize and uniquely identify rules in your profile.
Use the following steps to add an optional label to a load rule:
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.
When a deactiviated rule is linked to a tag or to consent, the deactivated rule is removed from the logic. If the deactivated rule is is the only linked rule, the all pages load rule is linked to the tag or consent.
When a deactivated rule is linked to an extension, the extension is flagged with an error and the user must link an active rule.
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.
If the rule is in use, you need to confirm that you want to turn it off. 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 pathname
contains checkout.html
OR if the product_category
contains 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.
When a rule contains multiple OR condidtions, evaluation of the rule stops when a true statement is found. The remaining statements are not evalutated because one true statement means the rule is true.
The components of a URL can be useful when creating load rule conditions. A URL typically consists of the following components:
URL Example:
http://www.tealium.com/app/solutions/?example=test&example2=test2#section3
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 domain1.com
:
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:
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 rule is active.
The time/time zone used for the load rules is determined by the visitor's browser, not the server or the visitor's time/time zone.
Use the following steps to add a date range condition to a load rule.
The following special considerations may apply:
any day
and any time
are used.To use UTC time instead of the browser's local time, see Time-based Load Rule using UTC.
Copyright All Rights Reserved © 2008-2022