# Tracked segments

> Tracked segments record who joins and leaves and when. Start automations and send webhooks on joins and leaves, and follow a segment's growth. Alpha: open to the Emailit team only.

A tracked segment is a [segment](/docs/segments/) that also stores its members. When a contact starts or stops matching its rules, Emailit records the change, so you can:

- start [automations](#start-automations) when someone joins or leaves,
- receive [webhooks](#webhooks) for joins and leaves,
- see the segment's [growth](#growth-and-the-joined-column) over time and when each contact joined.

Counts, the contact list and campaigns work the same way as for any segment: they evaluate the rules live and never use the stored members.

> **Segments are in alpha:** Segments, tracked or not, are open only to the Emailit team while we test them. See [Who can use segments](/docs/segments/#who-can-use-segments).

Tracked segments are included with Pro, Business and Custom plans, and count toward the same [segment limit](/docs/segments/#limits) as other segments.

## Create a tracked segment

When you create a segment, choose **Tracked segment** under **Type**. On Pay as you go, the option is disabled and shows **Upgrade**. With the API, pass `"tracked": true` to [Create a segment](/docs/api-reference/segments/create/).

The type can't be changed afterwards, in either direction. To track an existing segment, create a new tracked segment with the same rules. **Duplicate** keeps the original's type.

Right after it's created, a tracked segment shows **Recording current members** while Emailit stores everyone who already matches (`tracking.status` is `syncing` in the API). This first count doesn't send events or start automations: only contacts who join or leave after it count as changes.

## How members are updated

| What happens | When members update | `reason` |
| --- | --- | --- |
| A contact is created, edited, deleted, subscribes or unsubscribes, or an automation step changes it | Usually within a minute | `contact` |
| A contact import finishes, or an audience is deleted | When it finishes, for the whole segment | `contact` |
| Rules that move with time, such as **Created** in the last 30 days, and changes that don't produce contact events | Every day at 00:30 UTC, for the whole segment | `schedule` |
| You edit the segment's source or filters | Right after you save | `segment_updated` |

Each join or leave is recorded with its `reason`. Changes caused by editing the segment are sent to webhooks but don't start automations, so a rules change doesn't run an automation for everyone it affects. Contacts that leave because they were deleted send no event.

## Start automations

Two contact triggers start from a tracked segment:

| Trigger | API key | Starts a run when |
| --- | --- | --- |
| **Added to segment** | `contact.added_to_segment` | A contact joins the segment. |
| **Removed from segment** | `contact.removed_from_segment` | A contact leaves the segment. |

Pick the segment under **Tracked segment** on the trigger. Only tracked segments are listed, and only they can be used. Runs usually start within a minute of the join or leave.

For **Added to segment**, select **Also start for contacts already in the segment when the automation is first started** to also run the automation for current members. This happens once, on the automation's first start, for the members recorded at that moment. The automation's run settings, such as `allow_reentry` and `cooldown_seconds`, still apply. See [Use the API](/docs/automations/#use-the-api).

Joins and leaves can also end runs (**Removed from segment** as an exit condition), reach goals and resume **Wait until** steps. See [Exit conditions and goals](/docs/automations/exits-and-goals/).

A segment that an automation uses can't be deleted until you change that automation. See [Automation triggers](/docs/automations/triggers/#segment-triggers).

## Webhooks

Joins and leaves send these [webhook](/docs/webhooks/) events:

- [`segment.contact_added`](/docs/webhooks/events/segment/contact-added/) when a contact joins, with `joined_at`.
- [`segment.contact_removed`](/docs/webhooks/events/segment/contact-removed/) when a contact leaves, with `left_at`.

Both carry the segment's `id` and `name`, the contact's `id`, `email`, names and custom fields, and the `reason` from the table above. The contact's **Activity log** also shows "Joined segment" and "Left segment" entries.

## Growth and the Joined column

The segment page of a tracked segment has a **Growth** chart for the last 30 days: **Members** at the end of each day, and how many contacts **Joined** and **Left**. History starts when tracking starts, and the first count isn't shown as joins.

The contacts table adds a **Joined** column with the date the contact's current stay in the segment began. A contact who leaves and comes back gets a new date. It's empty until tracking has recorded the contact.

With the API, use [Retrieve segment growth](/docs/api-reference/segments/growth/) for up to 365 days, and [List segment contacts](/docs/api-reference/segments/contacts/) for `joined_at`.

## When tracking pauses

If the workspace moves to a plan without tracked segments, tracking pauses. The segment page shows **Tracking is paused** and `tracking.status` is `paused`:

- Members stop updating, no events are sent and no automations start from the segment.
- The segment still counts, lists and sends live, like any segment.

After you upgrade again, Emailit records the current members again at the next update, without sending events or starting automations, then tracking continues. Joins and leaves that happened while tracking was paused aren't recorded.

## Use the API

| Task | Endpoint |
| --- | --- |
| Create a tracked segment | [Create a segment](/docs/api-reference/segments/create/) with `"tracked": true` |
| Check the tracking state | `tracked` and `tracking` on [Retrieve a segment](/docs/api-reference/segments/get/) |
| Daily members, joins and leaves | [Retrieve segment growth](/docs/api-reference/segments/growth/) |
| When each member joined | `joined_at` on [List segment contacts](/docs/api-reference/segments/contacts/) |

On Pay as you go, `"tracked": true` returns `403` with `"error": "plan_required"` and `"required_plan": "pro"`. [List segments](/docs/api-reference/segments/list/) returns `usage.tracking_allowed`, which tells you whether the plan includes tracked segments.

## Related

  - [Automation triggers](/docs/automations/triggers/): Every trigger and its options.
  - [Event types](/docs/webhooks/event-types/): Every webhook event Emailit sends.

---
Source: https://emailit.com/docs/segments/tracked/
