> For the complete documentation index, see [llms.txt](https://community.commandersact.com/web-container/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community.commandersact.com/web-container/user-manual/container-management/rules/perimeters.md).

# Perimeters & constraints

*Perimeters* and *Constraints* are two methods to **conditionally** fire your tags.&#x20;

* Under the *Perimeter* panel, tags fire if at least **one rule** is true.
* Under the *Constraints* panel, tags fire if **all rules** are true.

## Variable

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.

“N**AND 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”).

![](https://2673302412-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdtBYhZj-wxWhoZaUXI%2F-LqHAJgxXBingSa2W27v%2F-LqHASu7Jt5OGjxcsZLN%2Fvariable_rule%5B1%5D.png?alt=media\&token=56d8eeae-491c-4fec-a764-c06e55888593)

**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:

![](https://2673302412-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdtBYhZj-wxWhoZaUXI%2F-LqHAJgxXBingSa2W27v%2F-LqHAXO57WR-_uhWfWRr%2Fdl%5B1%5D.png?alt=media\&token=bf8f2115-f8e4-4fb1-827a-2f023780b072)

**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:

```
tC.event.add_to_cart(this, {"product_name":"iphone", "product_id":"1234"})
```

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:

![](https://2673302412-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdtBYhZj-wxWhoZaUXI%2F-LqHAJgxXBingSa2W27v%2F-LqHAcnXVERqUsRkpIF0%2Fevent_rule%5B1%5D.png?alt=media\&token=59f15734-0772-49ba-ab7e-3bd01cb2c9e7)

## Cookie

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:

![](https://2673302412-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdtBYhZj-wxWhoZaUXI%2F-LqHAgUlviKXMBz2KAgt%2F-LqHAnPUqUSh_qRhJYzF%2Fcookie_rule%5B1%5D.png?alt=media\&token=bb57a03b-550a-4271-a694-6bcd6e51f54d)

## URL

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:

![](https://2673302412-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdtBYhZj-wxWhoZaUXI%2F-LqHAt3DyrXRRLp9PIi0%2F-LqHAycbHQ7T0JYIX3pA%2Furl_rule-1%5B1%5D.png?alt=media\&token=b81378c8-2216-43b7-9bc9-645443a77614)

## **Browser**

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).

![](https://2673302412-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdtBYhZj-wxWhoZaUXI%2F-LqHAt3DyrXRRLp9PIi0%2F-LqHB9DepblWNifKE1RQ%2Fbrowser_rule-1%5B1%5D.png?alt=media\&token=1a9df58e-404b-4221-ba42-aab78e37ed34)

## Mobile

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:

![](https://2673302412-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdtBYhZj-wxWhoZaUXI%2F-LqHAt3DyrXRRLp9PIi0%2F-LqHBM8iBsZi02tBcPxG%2Fmobile_rule%5B1%5D.png?alt=media\&token=25acea8c-cd98-46c2-9abd-0bff006202c6)

## DataCommander

This tab allows you to create rules based on the type of audience segments created in DataCommander.

**Condition and behavior**

&#x20;“**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

![](https://2673302412-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdtBYhZj-wxWhoZaUXI%2F-LqHAt3DyrXRRLp9PIi0%2F-LqHBUL8T24wJlkq7RrB%2Fdata_rule%5B1%5D.png?alt=media\&token=1a7d9138-e596-4165-b65b-cb23f9e0d5e4)

## Advanced rules

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 Intersectio**n”: 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:

![](https://2673302412-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LdtBYhZj-wxWhoZaUXI%2F-LqHAt3DyrXRRLp9PIi0%2F-LqHBcjitg-bAJEDKFDP%2Fsample_rule%5B1%5D.png?alt=media\&token=cbc6aeae-0938-43a7-9624-aeeb62913b5b)
