# Web Activity in Segments

Use web behavior as segment filter criteria

Mailnaptic's segment builder supports **web activity filters** that let you target contacts based on their website behavior. Combine these with demographic and engagement filters to create highly targeted audiences.

## Available web activity filters

The following filters are available in the segment builder under the **Web Activity** category:

| Filter | What it matches | Parameters |
| --- | --- | --- |
| `site_visited_page` | Contacts who visited a specific page | URL pattern (exact or contains) |
| `site_not_visited_page` | Contacts who have *not* visited a page | URL pattern |
| `site_triggered_event` | Contacts who fired a specific custom event | Event name |
| `site_not_triggered_event` | Contacts who have *not* fired a custom event | Event name |
| `site_purchased` | Contacts who completed a purchase event | None (matches `order_completed`) |
| `site_not_purchased` | Contacts with no purchase event on record | None |

## Adding a web activity filter

1. Open a segment in the segment builder (or create a new one).
2. Click **Add filter** and choose a filter from the **Web Activity** group.
3. Configure the filter parameters. For page visits, enter a URL or URL fragment. For custom events, enter the event name.
4. Optionally set a **time window** — for example, "visited in the last 7 days" versus "visited ever."
5. Click **Preview** to see the matching contact count.

## Combining filters

Web activity filters follow the same AND/OR logic as all other segment filters. Some powerful combinations:

- **High-intent browsers:** `site_visited_page` containing `/pricing` AND `email_opened` in the last 30 days.
- **Cart abandoners:** `site_triggered_event` = `product_added_to_cart` AND `site_not_purchased`.
- **Engaged but inactive on site:** `email_clicked` in the last 14 days AND `site_not_visited_page` containing `/` (no site visit at all).
- **Re-engage lapsed buyers:** `site_purchased` AND `last_active_days` greater than 60.

## URL matching

The `site_visited_page` and `site_not_visited_page` filters support two match modes:

- **Contains** — matches any URL that includes the specified string. For example, `/blog` matches `/blog`, `/blog/my-post`, and `/blog?page=2`.
- **Exact** — matches the full URL path exactly as entered.

### Graceful fallback

If site tracking has not been set up for your organization or the `site_event` table does not exist yet, web activity filters will simply return **zero matches** rather than causing an error. Once you install the tracking snippet and events begin flowing, the filters will start matching contacts automatically.

## Using web segments for campaigns

Once you've built a web-activity-based segment, you can use it anywhere segments are supported:

- As a **target audience** for a campaign.
- As an **exclusion segment** to remove certain contacts from a send.
- As a **trigger condition** in automations (e.g., "when contact enters segment").

> **Tip:** Use the AI segment builder to describe your audience in plain English — for example, "contacts who viewed the pricing page but haven't purchased." Mailnaptic will generate the correct web activity filters for you.
