# Conditions

> Every condition a rule can target, from location, device and traffic source to behavior, time and your own customer data.

Conditions decide who a rule is for. Each one compares one fact about the visitor with a value you set, such as *Country is Germany* or *Visit Count greater than 3*.

## Combining conditions

Conditions sit in groups. Inside a group, choose whether **all** conditions have to be true or **any** of them. Then choose the same between groups.

For example, to reach phone visitors from Germany or Austria:

- Group 1, all: *Device Type is mobile*
- Group 2, any: *Country is Germany*, *Country is Austria*
- Between groups: all

Use **Add Condition** for another condition in a group, and **Add Condition Group** for a new group.

## Operators

What you can compare depends on the condition:

| Condition kind | Operators |
| --- | --- |
| Text, such as a URL or a state | is, is not, contains, does not contain, starts with, ends with, is one of, is not one of, matches regex |
| Numbers, such as a visit count | is, is not, greater than, less than, between |
| A fixed list, such as device type | is, is not, is any of, is none of |
| Yes or no, such as First Visit | is, is not |

Text comparisons ignore case. **between** takes two numbers separated by a comma, such as `3,10`. **is one of** takes a comma-separated list.

## Audience

| Condition | Matches |
| --- | --- |
| **Audience Segment** | Visitors in a saved [segment](https://geoengage.app/docs/analytics/segments). Build an audience once and reuse it across rules and reports. |

## Location

Looked up from the visitor's IP address. For a visitor who can't be placed, a location condition is never true, not even *is not*, so a rule meant to exclude a country doesn't fire for visitors whose country is unknown. Conditions of other kinds still work for them.

| Condition | Compares | Example value |
| --- | --- | --- |
| **Country** | Country name | `Germany` |
| **Country Code (ISO)** | Two-letter code | `DE` |
| **State** | State or region name | `California` |
| **Continent** | Continent | North America, Europe, Asia… |
| **Timezone (IANA)** | The visitor's timezone | `Europe/Berlin` |

## Technology

| Condition | Values |
| --- | --- |
| **Device Type** | desktop, mobile, tablet |
| **Browser** | chrome, firefox, safari, edge, opera |
| **Browser Language** | The language the browser is set to, picked from a list. Only the language is compared, as a two-letter code such as `de`, so German matches a browser set to `de-DE` or `de-AT` alike. |

## Traffic

| Condition | Compares |
| --- | --- |
| **Page URL/Path** | The page being viewed now. |
| **Landing Page** | The page the visit started on, as a path such as `/pricing`. It stays the same as the visitor moves around. |
| **Referrer URL** | Where the visit came from. It stays the same for the whole visit. |
| **Session Source** | The visit's source: `utm_source` if the landing URL had one, otherwise the referring site, otherwise `direct`. |
| **Session Campaign** | The visit's campaign: `utm_campaign` if the landing URL had one, otherwise `utm_id`. Empty for a visit that arrived without one. |
| **URL Parameter** | A query parameter you name, such as `utm_campaign`, on the page being viewed now. |

**Page URL/Path** and **Landing Page** answer different questions: "is on `/pricing` right now" and "arrived on `/pricing`". Use **Landing Page**, **Session Source** or **Session Campaign** to keep recognizing a campaign visitor after they click away from the page they landed on. **URL Parameter** only sees the parameter on the page that has it.

## Time

In the visitor's own local time.

| Condition | Values |
| --- | --- |
| **Time of Day** | morning (midnight to noon), afternoon (noon to 5 pm), evening (5 pm to 9 pm), night (9 pm to midnight) |
| **Day of Week** | monday to sunday |

To run a rule between set dates or hours in one timezone for everyone, use a [schedule](https://geoengage.app/docs/rules/timing#schedules) instead.

## Behavior

| Condition | Compares |
| --- | --- |
| **First Visit** | Whether this is the visitor's first visit. A visit ends after 15 minutes without activity. |
| **Visit Count** | How many visits this browser has made. |
| **Days Since Last Visit** | Whole days since the previous visit began. A first-time visitor has no previous visit, so this never matches them, whichever operator you use. |
| **Pages This Session** | Pages viewed in this visit. |
| **Time on Site (sec)** | Seconds since the visit started, counted up to the page being loaded. |
| **Time on Page (sec)** | Seconds the current page has been open in front of the visitor. Time in a background tab doesn't count. |
| **Scroll Depth (%)** | The furthest down the current page the visitor has scrolled. Scrolling back up doesn't lower it. |
| **Consent Status** | accepted, rejected or pending, from the [compliance banner](https://geoengage.app/docs/widget/consent). |

> [!NOTE]
> Both start at 0 on every page, and on every route change in a single-page app. A rule that uses them and doesn't match when the page loads is checked again as the visitor scrolls, and every second, until it matches or they leave the page. So *Scroll Depth greater than 50* shows its action the moment the visitor passes halfway.

## Customer data

What your own site already knows about the visitor. Each of these takes a **key** — the name of the cookie, storage item, variable or attribute — as well as a value.

| Condition | Key | Compares |
| --- | --- | --- |
| **Cookie Value** | Cookie name | The cookie's value. |
| **Local Storage Value** | Storage key | The value stored under it. |
| **JS Variable (dot path)** | A path from `window`, such as `myApp.user.plan` | The variable's value. |
| **Visitor Attribute** | Attribute name | A value your code set with [`setAttributes()`](https://geoengage.app/docs/widget/methods#setattributes). |
| **Element Exists** | A CSS selector | Whether the element is on the page. |

> [!TIP]
> **Visitor Attribute** is the sturdiest of these. A cookie or a variable can be renamed by whoever maintains your site; an attribute is a value you set for GeoEngage on purpose.

---

Source: https://geoengage.app/docs/rules/conditions
