Perimeters and Constraints are two methods to conditionally fire your tags.
Under the Perimeter panel, tags fire if at least one rule is true.
Under the Constraints panel, tags fire if all rules are true.
The “Variables” tab allows you to create rules based on your data layer variables (external variables, internal variables, events attributes, events variables):
Condition and behavior
“If Variable Equals“: Tag activated if the variable equals the specified value.
“If Variable is Not Equal“: Tag activated if the variable differs from the specified value.
“OR Condition (One Variable)“: Tag activated if the variable equals at least one of the specified values.
“NAND Condition (One Variable)“: Tag activated if the variable equals two or more specified values.
“OR Condition (Up To Six Possible Variables)“: Tag activated if at least one of the variables equals the specified value.
“AND Condition (Up To Six Possible Variables)“: Tag activated if all the variables equal all the specified values.
“Greater than condition“: Tag activated if the variable is greater than the specified value.
“Less than condition“: Tag activated if the variable is less than the specified value.
“If Variable Contains“: Tag activated if the variable contains the specified value.
“If Variable Does Not Contain“: Tag activated if the variable does not contain the specified value.
“If Variable Matches“: Tag activated if the variable matches the specified value (regular expressions allowed: * to match any character and ^ for “variable begins with”).
“If Variable Doesn’t Match“: Tag activated if the variable does not match the specified value (regular expressions allowed: * to match any character and ^ for “variable begins with”).
In which case using “external variables” for the mapping?
When you want to create a rule based on a tc_vars from the data layer implemented on your website.
Example: your technical team has implemented an env_template variable, and you want to create a rule based on it:
In which case using “internal variables” for the mapping?
When you want to create a rule based on a variable that you have created by yourself, from the internal variable interface.
In which case using “event variables” for the mapping?
When you want to create a rule based on a variable specific to an event.
Example: The following event is implemented in your site’s source code:
To call a tag only if the product name is “iphone”, you have to select the event variable named “product_name” and configure it in the following manner:
The “Cookie” tab allows you to create rules based on cookies you have previously created in the Commanders Act interface or which are available for your site’s domain name (first-party cookies).
Condition and behavior
“If Cookie Equals“: Tag activated if the cookie’s value equals the specified value.
“If Cookie Is Not Equal“: Tag activated if the cookie’s value differs from the specified value.
“If Cookie Contains“: Tag activated if the cookie’s value contains the specified value.
“If Cookie Doesn’t Contain“: Tag activated if the cookie’s value does not contain the specified value.
Example: In order to call a tag when your “user_logged” cookie equals “1”, you must select the “If Cookie Equals” rule and configure it in the following manner:
This tab allows you to create rules based on your site’s URLs (note: we recommend that you use rules based on variables instead of URLs since the rule will become obsolete if your URL changes in the future):
Condition and behavior
“If URL Equals“: Tag activated if the URL equals the specified value.
“If URL Contains“: Tag activated if the URL contains the specified value.
“If URL Doesn’t Contain“: Tag activated if the URL does not contain the specified value.
“If URL Matches“: Tag activated if the URL matches the specified value (regular expressions allowed: * to match any character and ^ for “variable begins with”).
“If URL Doesn’t Match“: Tag activated if the URL does not match the specified value (regular expressions allowed: * to match any character and ^ for “variable begins with”).
Example: to call a tag when your URL indicates that the user is on the product page (providing your product page URLs are all structured the same: http://www.site.com/$category$/$subcategory$/product_$product_ID$), you have to select the “If URL Matches” rule and configure it in the following manner:
This tab allows you to create rules based on browsers.
Condition and behavior
“If Browser Is“: Tag activated if the browser is (choose from the list).
“If Browser Is Not“: Tag activated if the browser is not (choose from the list).
This tab allows you to create rules based on the type of device.
Condition and behavior
“If Device / OS Is“: Tag activated if the device is (choose from the list).
“If Device / OS Is Not“: Tag activated if the device is not (choose from the list).
“If Device / OS Is Android Tablet“: Tag activated if the device is an Android tablet.
“If Device / OS Is Android Mobile“: Tag activated if the device is an Android mobile device.
“If Device / OS Is Not Android Tablet“: Tag activated if the device is not an Android tablet.
“If Device / OS Is Not Android Mobile“: Tag activated if the device is not an Android mobile device.
Example: to prevent a tag from being called on an Android mobile device, you must select the “If Device Is Not Android Mobile” rule and configure it in the following manner:
This tab allows you to create rules based on the type of audience segments created in DataCommander.
Condition and behavior
“DataCommander OR condition (up to six variables)“: Tag activated if at least one of the audiences equals the specified value.
“DataCommander AND condition (up to six variables)“: Tag activated if all the audiences equal all the specified values.
“DataCommander Event activation“: Tag activated on an event
This tab allows you to create all types of advanced rules. For example, you can create sampling rules or even “Custom” rules:
Condition and behaviour
“Sampling (1/X) (Page Based)“: Tag activated in X% of page views.
“Sampling (1/X) (Session Based)” : Tag activated in X% of visits.
“Sampling (1/X) (Visitor Based)“: Tag activated for X% of visitors.
“(A or B or C or D or E) AND (F or G or H or I or J)“: Tag activated if at least one of the variables in the first group AND at least one of the variables in the second group equal the specified values.
“(A and B and C and D and E) AND (F or G or H or I or J)“: Tag activated if all the variables in the first group AND at least one of the variables in the second group equal the specified values.
“(A and B and C and D and E) OR (F and G and H and I and J)“: Tag activated if all the variables in the first group OR all the variables in the second group equal the specified values.
“(A and B and C and D and E) OR (F or G or H or I or J)“: Tag activated if all the variables in the first group OR at least one of the variables in the second group equal the specified values.
“(A different than VALUE1) OR (B different than VALUE2)“: Tag activated if the first variable is not equal to a value OR the second variable is not equal to a value.
“(A different than VALUE1) OR (B equals VALUE2)“: Tag activated if the first variable is not equal to a value OR the second variable is equal to a value.
“(A different than VALUE1) AND (B different than VALUE2)“: Tag activated if the first variable is not equal to a value AND the second variable is not equal to a value.
“(A different than VALUE1) AND (B equals VALUE2)“: Tag activated if the first variable is not equal to a value AND the second variable equals a value.
“In Array“: Tag activated if the variable is present in the variable array.
“In Sub Array“: Tag activated if the variable is present in a variable array key.
“Array Intersection”: Tag activated if two variables from two variable arrays are equal.
“Custom“: Custom rule (to define in JavaScript).
Example: In order to call a tag for 25% of site visitors, you must select the “Sampling (1/X) (Visitor Based)” and configure it in the following manner:
You can select a default trigger in the container options.
This means that each time you will add a tag to your container, the default trigger(s) will apply on this tag.
To select your default trigger(s), go in the container options (1), “advanced” part (2):
This trigger allows calling tags when the container is loaded on a page. It is the default trigger for all the tags you add to your container. This means that the tag will only be called when your JavaScript container loads on your site, but it will not be the case for other event types (such as a click, a page change within an “single page applications” environment, etc.). In order to trigger tags when a container loads on your page, all you need to do is selecting them from the list.
This trigger allows calling tags when the page’s structure is built (on the “DOM Ready” event). To launch tags on this event, all you need to do is selecting them. They will be called on the DOM Ready event when the page loads.
This trigger allows calling tags whenever elements of the page are clicked. Example: if you would like to call a tag when a user clicks a button (ex: “add to cart” button), select the desired tag(s) and enter the code allowing to target the button or the link on your page in the “CSS Selector” field.
Must know:
To retrieve the CSS selector, open your browser’s console and use its targeting tool (1) to target one of your page’s elements (2). Then right-click, the code appearing in your console (3), click “Copy” and “Copy selector” (4). All you have to do next is pasting this code in the interface.
You can enter many selectors in the interface; you will have to separate them with commas.
This trigger allows calling tags when a user submits a form. Example: when they click the “submit” button or press the Enter key. To call a tag when a form is submitted, follow the same steps you followed to call a tag upon a click. Indicate your trigger’s name (ex: “account creation confirmation”), select the desired tag(s) and enter the code allowing targeting the form submission button on your page in the “CSS Selector” field.
This trigger allows calling tags when a user scrolls the page vertically or horizontally. In order to execute a tag on scrolling, you will need to enter your trigger’s name (ex: “30% vertical scrolling”), select the desired tag(s), choose the scrolling type (horizontal/vertical) from the dropdown menu, the expected scrolling and measuring unit (page percentage or pixels).
This trigger allows calling tags whenever a TagCommander event function (tC.event.xxx) is identified on the page. If you wish to execute a tag on a custom eventm, please indicate your trigger’s name (ex: “add to cart click”), select the desired tag(s) and enter the implemented event function’s name (ex : “tC.event.add_to_cart”).
You can use the “Summary” interface to assign previously created rules directly to the new tags you want to add to the container:
By default, a newly added tag is called on the container loaded trigger, on all pages, with no constraints.
You can use this interface to add perimeters and constraints alerady created to tags or events added afterwards or modify them from the “Summary” interface:
To add a perimeter to a tag, you must check the box where the tag line and the perimeter column intersect (1). You can also delete a tag’s perimeter(s) by checking the green “All pages” column. The tag will now activate on all pages (2).
To add a constraint to a tag, click edit button close to the triggers and use the existing constraints list to select those you wish to add to your tag (3).
Additional information:
You can add multiple triggers, perimeters and constraints to the same tag:
The “OR” logic operates when multiple triggers are added to a tag. For example, if you check the “Container loaded” and “add to cart button” triggers, your tag will activate in one case OR the other, i.e. on the container loaded and at the click on the button.
The “OR” logic operates when multiple perimeters are added to a tag. For example, if you check the “homepage” and “account creation page” perimeters, your tag will activate in one case OR the other, i.e. for the homepage and the account creation page.
The “AND” logic operates when multiple constraints are added to a tag. For example, if you check the “logged user” and “mobile exclusion” constraints, your tag will activate only if the two conditions are met, i.e. only for logged users AND everything except a mobile device.
The “AND” logic operates when a trigger, a perimeter and a constraint are added to the same tag. For example, if you check the “container loaded” trigger, the “homepage” perimeter and the “logged user” constraint, your tag will activate only if the three rules are valid, i.e. only at the container loaded AND on the homepage AND logged visitors.
You can add 3 types of rules: constraint, perimeters and triggers.
Perimeters are the page types you want to activate your tags for (example: the homepage, “my account” page, product page, etc.).
Constraints are rules based on criteria other than the page type (example: rules based on visitor status, the type of browser or device, etc.).
Triggers are rules allowing to execute tags on different conditions: container loaded, DOM Ready, clicks, form submissions, scroll and custom events.
To create a new trigger, click “Trigger” (1) > “ADD TRIGGER” (2):
To create a new perimeter, click “Perimeters” (1) > “ADD PERIMETER” (2):
To create a new constraint, click “Constraints” (1) > “ADD TAG CONSTRAINT” (2):
By clicking “Add trigger” a rule creation interface will appear. This interface allows you to create a trigger of your choice: container loaded, DOM ready, click, form submission, scroll and custom.
By clicking “Add perimeter” or “Add tag constraint“, a rule creation interface will appear. This interface can be seen as a “tool box” that allows you to create rules based on various elements: cookies, data layer variables, URLs, etc.
The “tools” available to you can be selected at the top of the rules creation interface (1), and various options allow you to create the most appropriate rule for your tag (2). For each new rule created, make sure to complete the “Name” field (rule name), check the boxes of the tags to which the rule applies and configure the rule (3).
Note: The perimeter and constraint creation interfaces offer the same options, but in the constraint creation interface you need to link the constraint to a specific trigger:
To modify a rule, click the “edit” icon (1).
Note: you can modify the rule’s name and value. However, you must create a new rule if you wish to change its type: if you want to replace the “If Variable Equals” rule with “If Variable Is not Equal”.
To delete a rule, click the “trash” icon (1):
Note: your rule will be saved in the trash (2), where you can recover or permanently delete it at any time (3):
The “RULES” step allows you to create your tag activation rules.
You can manage how your tags and events are called by using the four tabs displayed in the left menu (1):
The “Summary” tab provides you with an overview of the created rules per tag and event.
The “Triggers” tab allow you to create triggers for your tags. Triggers are rules allowing to execute tags on different conditions: container loaded, DOM Ready, clicks, form submissions, scroll and custom events.
The “Perimeters” tab allows you to create perimeters for your tags. Perimeters are the page types for which you want to activate your tags (for example: the homepage, “my account” page, product page, etc.).
The “Constraints” tab allows you to create constraints for your tags and events. Constraints are rules based on criteria other than the page type (for example: rules based on visitor status, the type of browser or device, etc.) Note: You must use constraints if you want to create a rule for an event.
The “Deduplication” tab allows you to implement deduplication rules for your tags.