# Pages and visits conditions

You'll find the rules for matching pages, counting visits, and recognizing returning visitors, including how much browsing history each condition can use.

Available on the Grow, Scale, and Pro plans.

You can show different content based on where someone is on your site, which pages they've visited, or how often they've returned. These conditions are under **On-Site Behavior**.

## What it checks

These conditions use the visitor's current page or browsing history that's still available in their browser. They can match a page or domain, count pageviews or visits, and distinguish first-time from returning visitors.

For `https://workforge.rightmessage.com/pricing.html?utm_campaign=teams`, the domain is `workforge.rightmessage.com` and the path is `/pricing.html`. The query belongs to [UTM](https://rightmessage.com/help/conditions-utm) or [query parameter](https://rightmessage.com/help/conditions-query) conditions.

## When to use it

Use a current-page condition when content belongs on one page. Use a history condition when the pages someone has visited should affect what you show them next.

For example, [WorkForge](https://workforge.rightmessage.com) can distinguish someone reading its pricing page from someone who has returned several times. Those are separate checks, even if both visitors are on the same page now.

## Options

### Pages viewed

**Pages viewed** starts with **Equals**, a blank path, and **For the current page**.

![Pages viewed condition matching /pricing-page for the current page](https://rightmessage.com/help/screens/segmentation-current-page.light.webp)

| If you'd like to check…                                          | Occurrence                | Additional fields                    |
| ---------------------------------------------------------------- | ------------------------- | ------------------------------------ |
| The current page's path                                          | **For the current page**  | None                                 |
| The path immediately before the current page in retained history | **For the previous page** | None                                 |
| How many pageviews match a path comparison                       | **Has visited**           | Count operator, count, and timeframe |
| Whether no pageviews match a path comparison in a timeframe      | **Has not visited**       | Timeframe                            |

The previous page can belong to an earlier visit. Without a previous page, the condition doesn't match, even with a negative operator.

The path operators are **Equals**, **Does not equal**, **Contains**, **Does not contain**, **Starts with**, **Ends with**, **Wildcard match**, **Is set**, and **Is not set**. **For the current page** also offers **Matches pattern**.

**Has visited** offers **Exactly**, **At least**, **At most**, **More than**, and **Less than**, followed by a numeric count. Without a supplied count or count operator, RightMessage checks for at least one matching pageview. **Has not visited** has no count field and requires zero matches.

Both history options offer **Ever** and **In the last**, starting with **Ever**. **In the last** adds a duration and **Weeks**, **Days**, or **Hours**. A newly opened duration window defaults to one week.

### Path matching

Paths normally start with `/`, such as `/pricing.html`. Ordinary path comparisons ignore leading and trailing slashes, so `/pricing.html` and `/pricing.html/` match under **Equals**.

**Contains** keeps the slashes when your comparison starts and ends with `/`. For example, `/solutions/` distinguishes that path section from the letters `solutions` elsewhere in a path.

**Wildcard match** uses glob matching. **Matches pattern** is available only for the current page and also accepts `*`, such as `/solutions/*`. It removes one leading and trailing slash before comparison. Neither operator is a regular-expression editor.

Path comparisons are case-sensitive. **Is set** and **Is not set** don't need comparison text, although the path field stays visible. Ordinary comparison removes surrounding slashes, so the root path `/` becomes empty for these presence checks. They aren't general checks for whether RightMessage knows the current URL.

The ordinary path input accepts full URLs. For **Pages viewed** and **Original landing page**, the URL's hostname must match the current hostname.

A domain-only value without a trailing slash skips the path comparison. For historical **Pages viewed** conditions, it also skips the count and timeframe. **Has visited** matches and **Has not visited** doesn't. Use a path with a separate domain condition when counts or time windows matter.

For filtered **Page count**, use a path rather than a full URL. A matching hostname supplies its path. A different hostname produces an empty comparison path instead of a separate hostname check.

### Original landing page

**Original landing page** compares the first recorded path, not the first page of each new session. It offers the nine ordinary path operators and starts with **Equals** and a blank path.

### Current domain

**Current domain** compares the current hostname. It starts with **Equals** and a blank value. It offers the nine text operators plus **Matches**.

Ordinary text operators compare lowercase hostnames and values. For example, **Equals** with `example.com` doesn't include `app.example.com` or `www.example.com`.

**Matches** works differently. It ignores a leading `www.` on both sides, and a blank value or `*` means any domain. It doesn't treat `*.example.com` as a subdomain wildcard. **Wildcard match** is the separate operator for glob matching.

A domain condition doesn't include a protocol, port, page path, query, or hash. It checks where the visitor is now, not the hostname from a previous pageview.

### Page count

**Page count** counts recorded pageviews, not unique URLs. Repeat views of the same page count too.

| Field                                   | Options                                                                                                              |
| --------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| Scope                                   | **Any page**; **Pages matching**                                                                                     |
| Path comparison, for **Pages matching** | **containing**; **starting with**; **equal to**; **not containing**; **not equal to**; **ending with**; **matching** |
| Count comparison                        | **At least**; **At most**; **Exactly**; **More than**; **Less than**                                                 |
| Count                                   | Numeric pageview count                                                                                               |
| Timeframe                               | **Ever**; **In the last**                                                                                            |
| Duration unit                           | **Weeks**; **Days**; **Hours**                                                                                       |

The initial selections are **Any page**, **At least**, and **Ever**. The count field's placeholder is `1`. A blank or zero count is evaluated as `1`. A filtered path starts with **containing**. A selected duration window defaults to one week.

An incomplete **Pages matching** filter without a path or operator doesn't narrow the count. Don't use it as a rule intended to match zero pages.

### First-time and returning visitors

**First-time visitor** has no value fields. It matches when retained history contains no earlier session.

**Returning visitor** requires a prior session and offers these timeframes:

- **Has ever visited the website before**, the initial selection.
- **Has visited in the last**, followed by duration and unit.
- **Hasn't visited in the last**, followed by duration and unit.

The duration units are **Weeks**, **Days**, and **Hours**. Choosing a duration timeframe initially sets it to one week. The comparison uses the last recorded page before the current session, not the first-ever page or a CRM date.

For these conditions, a gap greater than one hour between recorded pageviews marks a new session. Someone browsing several pages without that gap is still on the same visit. Reporting screens use a different, 30-minute session gap.

Without an earlier session, none of the **Returning visitor** options match. **Hasn't visited in the last** doesn't include a completely new visitor.

### Session count

**Session count** offers **At least**, **At most**, **Exactly**, **More than**, and **Less than**, followed by a count. It starts with **At least**. A missing or zero threshold is evaluated as `1`.

RightMessage counts visits using gaps greater than one hour in retained history and accounts for the current visit. Without stored pages, the visitor is in their first session. This trigger has no timeframe selector.

### First visited

**First visited** compares elapsed time since the first recorded pageview. Its operators are **At least**, **At most**, **More than**, **Less than**, and **Exactly**. Its units are **Weeks**, **Days**, and **Hours**.

The initial operator is **At least**, and the first unit is **Weeks**. Enter the duration you want. If a saved rule has no usable duration, RightMessage falls back to `1`. An absent unit falls back to days. A placeholder isn't a saved threshold.

Elapsed age isn't rounded to whole days or weeks. **Exactly** with `2` **Days** compares against exactly two elapsed days, not every instant on the second calendar day. Without a recorded first page, this condition doesn't match.

## Examples

The path comparison happens before the count comparison. These two rules mean different things:

| If you'd like to check…                              | Rule                                                 |
| ---------------------------------------------------- | ---------------------------------------------------- |
| Whether someone has viewed a page other than pricing | **Has visited**, **Does not equal**, `/pricing.html` |
| Whether someone has never viewed pricing             | **Has not visited**, **Equals**, `/pricing.html`     |

A WorkForge visitor who first arrived at `/solutions/agencies.html` can still match that **Original landing page** rule while viewing `/pricing.html`. To show content only on the pricing page, add a separate current-page rule.

A **Page count** rule with **Pages matching**, **starting with**, `/solutions/`, **At least** `3`, and **In the last** `1` **Weeks** counts three qualifying views. It doesn't require three different pages.

## Things to know

**Ever** means history still available to this browser. It doesn't search all server-side analytics or every device belonging to a contact.

RightMessage stores the first page separately. Other older pageviews can be removed when browser storage fills. Clearing browser data, blocked storage, or a different origin can change the available history. These conditions don't impose a universal 30-day or 90-day lifetime.

Time windows are rolling durations. A day is 24 hours and a week is seven days. They aren't calendar-week or project-timezone filters.

[Referrer conditions](https://rightmessage.com/help/conditions-referrer) cover the site that sent the visitor. The [condition builder reference](https://rightmessage.com/help/condition-builder-reference) covers groups and negative comparisons.
