After you create a deployment group and add tags to it, you can add tag rules. Tag rules are different from deployment group rules. Deployment group rules apply to all tags in the group and tag rules apply to subsets of tags in the group.
To set these rules:
- Go to the deployment groups.
- From the deployment group, select the three-dot menu > Edit group
- Go to the Rules tab.
- Click Add rule to add a rule to tags in the deployment group.
- Provide details about the tag rule:
- Select a rule category in the drop-down.
- Enter a name for the rule.
- Add tags to which the rule applies. This step lets you apply a tag-level rule to a subset of group tags.
- Click Next.
- Define rule conditions. To add more conditions, click Create (+).
- Click Add rule.
Rules that are applied to a deployment group tags control the tags within the deployment group. You can add rules while creating the deployment group, or add or delete them later by editing the deployment group.
- Deployment rules based on activation date
- You can create a deployment rule based on an activation date, deactivation date, or both, so that tags execute only after the activation date, stop executing after the deactivation date, or execute only between the activation and deactivation dates.
- Deployment rules based on referral sources
- You can create deployment rules based on referral source (such as a particular partner, which is mapped to various partner codes). You can also specify that a particular tag executes only if a particular partner= is a referral source within the last 10 days.
- Deployment rules based on custom values
- Deployment rules based on custom values that are extracted from web pages allow a great amount of flexibility. Tag values can be based on many methods, including cookies, HTML, JavaScript object, local or session storage, URL, and other methods. For example, you can create a deployment rule that evaluates the value of a JavaScript variable (such as age) on your page. Only if some required age limit criteria (such as Age is equal to or greater than 18) is met, then a tag can execute.
- As a further example, you can create a page variable on your shopping site page to track the total purchase amount currently in the shopping cart. If the value of this total purchase amount variable meets your criteria, then an event tag can execute to indicate to the customer that they qualify for free shipping.
- Or, you might create a deployment rule that ensures a tag fires only if a certain value orKeyName does NOT exist, by using any of the rule operands.
What's next?
Deploy the deployment group. For details, check out Deploy tag deployment groups.