Back

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:

  • Currency Converter
  • Data Validation
  • Channels

This article provides information on adding and managing load rules.

In this article:

How it Works

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.

Boolean Logic

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.

AND Logic

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.

OR Logic

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.

Comparison Operators

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. 

Managing Load Rules

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.

load-rules-list-view.png

The UID column displays the numeric identifier for each load rule. This value can be useful when debugging utag.js.

Sort the List of Load Rules

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.

  • Name – Sort load rules by rule name, in alphabetical order, or reverse alphabetical order.
  • Date Modified – Sort load rules by modified date, most recent first or oldest first.
  • Modified By – Sort load rules by email address of the last user that modified the load rule, in alphabetical order, or reverse alphabetical order.
  • UID - Sort load rules by UID, either ascending or descending.

Create a Load Rule

Use the following steps to create a load rule:

  1. On the Load Rules screen, click + New Rule.
    The Add Rule dialog is displayed.
  2. Add a Title for the load rule, and optional Notes if needed.
  3. Use the drop-down lists to select a Variable and an Operator, then enter a Value.
    load-rules-add-rule.png
  4. To add another condition using AND logic, do one of the following:
    • Click + next to the default conditional statement.
    • To create a copy of a conditional statement using AND logic by clicking the row menu and selecting Duplicate Row.
      The duplicate conditional statement can be edited as needed.
  5. To add another condition using OR logic, do one of the following:
    • Click +OR.
    • Create a copy of a condition using OR logic by clicking the condition menu and selecting Duplicate.
      The duplicate condition can be edited to create a new condition.
  6. To expand long values, such as a URL, do one of the following:
    • Click the row menu and select Expand Value.
    • Click the condition menu and select Expand All Values.
  7. To remove a condtional statement from a condition, click the row menu and select Remove Row.
  8. To finish, click Apply.
  9. Click Save/Publish.

Assign Load Rules to a Tag

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:

  • Match All Rules
    Select this option to apply AND logic to the load rules. The tag loads only when all of the selected load rules evaluate to true.
  • Match Any Rule
    Select this option to apply OR logic to the load rules. This tag loads when any of the selected load rules evaluate to true.

View Load Rule Details

On the Load Rules screen, click a load rule. The detailed rule screen is displayed.

load-rules-purchase-500.png
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.

Add a Label to a 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:

  1. In the detailed rule screen, click Apply Label.
    load-rules-apply-label.png
  2. To apply an existing label, select a label.
  3. To create a new label, click Manage Labels. For more information, see Labels.
  4. When you have finished applying labels, close the Add New Label screen.
  5. To save the newly applied label, click Save/Publish.

Activate or Deactivate 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.
WhiteUI_TiQ_Load Rule Toggle ON.png
If the rule is in use, you need to confirm that you want to turn it off. The toggle button changes to display OFF.
WhiteUI_TiQ_Load Rule Toggle OFF.png

To reactivate a load rule, click the OFF toggle button.

Delete a Load Rule

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:

  1. On the Load Rules screen, click the load rule that you want to delete.
  2. In the Details screen for the rule, click Delete.
    A confirmation dialog is displayed.
  3. To confirm, click Delete Load Rule, otherwise, click Cancel.
    load-rule-delete.png
  4. If the load rule you want to delete is in use, a message is displayed with the details.
    load-rules-delete-tag-scoped.png
  5. To continue and delete the load rule, click Delete.

Examples

AND Logic

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.

load-rules-and-logic.png

OR Logic

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.

load-rules-or-logic.png

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.

Using URL Components in Load Rules

The components of a URL can be useful when creating load rule conditions. A URL typically consists of the following components:

  • Protocol – The method used to process the URL. For example, HTTP or HTTPS.
  • Domain – The domain name. For example, www.tealium.com.
  • Path – The section and page on the site.
  • Hash – Begins with a hash mark (#) and identifies a section within the page.
  • Query String – Begins with a question mark (?) and specifies key/value parameters containing dynamic data passed to the page.

URL Example:

http://www.tealium.com/app/solutions/?example=test&example2=test2#section3

Data Layer Variables

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"

Example using Domain

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:

load-rules-domain.png

Example Using Domain AND Pathname

To load tags on the homepage for domain1.com, use the following rule:

load-rules-domain-pathname.png

Example of Pathname to Specify a Section of a Domain

To load tags on pages in the support section of domain1, use the following rule:

load-rules-any-support-page.png

Example of 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:

load-rules-support-query-string.png

Using Time-Based Conditions

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.

  1. Click Add a date range condition.
    The date and time range dialog is displayed.
    load-rules-date-time-range.png
  2. Click in the Start Date field to select a start date from the calendar.
  3. Click the default time to select a different start time.
  4. Click in the End Date field to select an end date from the calendar.
  5. Click the default time to select a different end time.
  6. Click Apply.

Special Considerations

The following special considerations may apply:

  • If no time range is specified, the default values any day and any time are used.
  • The date or time that is highlighted when you click on a field is the current date or time.
  • You can specify only one date range condition per load rule.
    To apply more than one date range to a tag, you must create another load rule with the second date range.

To use UTC time instead of the browser's local time, see Time-based Load Rule using UTC.

Public