Targeting rules let you control who sees a tag and when it runs. You can limit a tag to certain visitors, pages, times, or other conditions, so it runs only where you want it to. You can combine several rules on one tag for more precise targeting.
Available targeting rules
By default, a tag runs on the path you attach it to. Add targeting rules to narrow this down further.
Each rule either includes or excludes the tag for the visitors, pages, or conditions you choose. When a tag has more than one rule, all of them must match for the tag to run.
There are four groups of rules. You can add more than one rule to the same tag.
Most popular
Cookie settings: Run the tag only for visitors in a cookie permission group you've defined in your cookie consent settings. See the cookie consent article.
Experiment: Include or exclude the tag based on an experiment group, for A/B testing. See A/B test with experiments.
Deduplication: Use markers to limit how often the tag runs. See Deduplication with markers.
Event: Run the tag when a specific event happens on the page.
Visitor-based
Browser / device: Include or exclude the tag for specific browser types, and even specific browser versions.
Country: Include or exclude the tag for specific country codes.
Visitor IP: Include or exclude the tag based on visitor IP ranges.
Audience: Include or exclude the tag based on audiences.
Orchestration: Include or exclude the tag based on a visitor's place in a journey or audience. Select a step in a particular journey or audience for the rule to match, or invert it to exclude that journey or audience.
Page-based
Property: Run the tag based on the presence or value of a data layer property.
Page URL: Include or exclude the tag based on the page URL and its parameters. Matching the full URL uses regular expressions.
Referrer URL: Include or exclude the tag based on the URL the visitor came from.
Other
Date: Run the tag only within a specific date range. The date range uses your site's configured time zone.
Time of day: Run the tag only within specific time ranges.
Environment: Exclude a specific environment. This lets you use a separate tracking account for each environment and keep your statistics clean.
Before you begin
You can add targeting rules only existing tags. To create a tag first, see How to create and manage tags.
Instructions
In Data Activation, navigate to Tags and select Pages.
Open the tag you want to add a rule to.
Click the pencil icon to configure rules.
Select the type of rule you want to add.
Set the rule's options, and choose whether to include or exclude the tag when the rule matches.
Save the rule. Any rules you've added appear under Rules.
Remember to publish your changes to apply the rule on your site.