> ## Documentation Index
> Fetch the complete documentation index at: https://docs.brudcast.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a segment

> Group contacts by rules that update themselves, or freeze a fixed set of contacts for a campaign.

export const DemoVideo = ({id, title, embedUrl, src, poster, duration}) => {
  if (embedUrl) {
    return <figure className="brd-media" data-media-id={id}>
        <iframe className="brd-media-frame w-full aspect-video" src={embedUrl} title={title} allow="accelerometer; autoplay; clipboard-write; encrypted-media; picture-in-picture" allowFullScreen />
      </figure>;
  }
  if (src) {
    return <figure className="brd-media" data-media-id={id}>
        <video className="brd-media-frame w-full aspect-video" src={src} poster={poster} controls playsInline preload="metadata" />
      </figure>;
  }
  const label = duration ? `Video walkthrough coming soon · ${duration}` : "Video walkthrough coming soon";
  return <Placeholder id={id} kind="video" label={label} description={title} ratio="16 / 9" icon={<PlayIcon />} />;
};

export const Loop = ({id, src, alt, caption}) => {
  if (!src) {
    return <Placeholder id={id} kind="loop" label="Animation coming soon" description={alt} icon={<PlayIcon />} />;
  }
  return <figure className="brd-media" data-media-id={id}>
      <video className="brd-media-frame" src={src} autoPlay muted loop playsInline aria-label={alt} />
      {caption && <figcaption className="brd-media-caption">{caption}</figcaption>}
    </figure>;
};

export const Screenshot = ({id, src, srcDark, alt, caption}) => {
  if (!src) {
    return <Placeholder id={id} kind="screenshot" label="Screenshot coming soon" description={alt} icon={<ImageIcon />} />;
  }
  return <figure className="brd-media" data-media-id={id}>
      <img className="brd-media-frame block dark:hidden" src={src} alt={alt} />
      <img className="brd-media-frame hidden dark:block" src={srcDark || src} alt={alt} />
      {caption && <figcaption className="brd-media-caption">{caption}</figcaption>}
    </figure>;
};

A segment is a saved group of contacts defined by rules, such as "email is verified and tagged
`vip`". Use one as a campaign audience or as the source of an export.

<Screenshot id="ss-contacts-segments-hero" alt="The Segments page listing dynamic and static segments with their contact counts" />

<Info>
  **Before you start:** segment rules read the data on your contacts: statuses, tags, language,
  time zone and dates. Import or add some contacts first so the rules have something to match.
</Info>

<Accordion title="Watch the walkthrough" icon="circle-play">
  <DemoVideo id="V08" title="Build a dynamic segment" duration="2 min" />
</Accordion>

## Dynamic or static

| Type        | What it holds                                                                                                 | When to use it                                                           |
| ----------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| **Dynamic** | Every contact that matches the rules at the moment you look. Membership changes as your contacts change.      | An audience you reuse, like "active contacts in Lagos".                  |
| **Static**  | A fixed set of contacts. Either you add them by hand, or a filter captures the matches once and freezes them. | A one-off send where the list mustn't grow between approval and sending. |

You choose the type when you create the segment. A dynamic segment can be frozen into a static one
later, but a static segment can't become dynamic.

### Segments or lists

A segment is built from rules or a frozen selection, while a [list](/contacts/lists) is a group
people join and can leave by unsubscribing. A campaign can take both.

## Create a segment

<Steps>
  <Step title="Open the builder">
    Go to **Contacts > Segments** and select **Create Segment**.
  </Step>

  <Step title="Name it and pick a type">
    Enter a **Segment Name** (it must be unique in your organization) and an optional
    **Description**. Under **Segment Type**, choose **Dynamic** or **Static**.
  </Step>

  <Step title="Add rules">
    Under **Filter Rules**, choose whether a contact must match **All (AND)** or **Any (OR)** of the
    rules. Then select **Add Rule** and pick a field, an operator and a value for each one.

    <Loop id="lp-contacts-segments-add-rule" alt="Adding a Tag is vip rule and switching the match from All to Any" />

    For a static segment the rules are optional. Leave them empty to build the segment by hand
    after you create it.
  </Step>

  <Step title="Create it">
    Select **Create Segment**. Brudcast works out the matching contacts after the segment is
    saved, so the count appears on the segment's page rather than in the builder.
  </Step>
</Steps>

## Fields and operators

| Field              | Operators                                                                          | Values                                                          |
| ------------------ | ---------------------------------------------------------------------------------- | --------------------------------------------------------------- |
| **Email Status**   | is, is not                                                                         | `verified`, `unverified`, `bounced`, `complained`, `suppressed` |
| **SMS Status**     | is, is not                                                                         | `verified`, `unverified`, `invalid`, `opted_out`                |
| **Contact Status** | is, is not                                                                         | `active`, `inactive`, `archived`                                |
| **Tag**            | is, is not, contains, does not contain, starts with, ends with, is set, is not set | A tag name                                                      |
| **Language**       | same as Tag                                                                        | A language code, for example `en`                               |
| **Timezone**       | same as Tag                                                                        | A time zone, for example `Africa/Lagos`                         |
| **Created At**     | before, after, on, between, in the last (days)                                     | A date, two dates, or a number of days                          |
| **Last Activity**  | before, after, on, between, in the last (days)                                     | A date, two dates, or a number of days                          |

A few rules behave in ways that are easy to miss:

* **Email Status** and **SMS Status** look at every address or number on the contact. "Email
  Status is `verified`" matches a contact with at least one verified address.
* **is not** on a status or a tag also matches contacts that don't have one at all. "SMS Status is
  not `opted_out`" includes contacts with no phone number.
* **contains**, **starts with** and **ends with** ignore case.
* **is set** means the field has a value; for **Tag**, it means the contact has any tag.
* A dynamic segment with no rules matches no one. It doesn't fall back to "everyone".

## The segment page

Open a segment to see its **Contacts** and **Rules** tabs. The **Contacts** tile shows how many
contacts are in it.

<Screenshot id="ss-contacts-segments-01-detail" alt="A dynamic segment's page showing the contact count, the Freeze menu and the Matching Contacts table" />

* **Dynamic segments** recalculate their count whenever you open them. The number can lag a
  change to your contacts by up to 30 seconds.
* **Static segments** show the contacts frozen into them. Select **Add contacts** to add more, or
  the remove icon on a row to take one out. Removing a contact from a segment doesn't delete it.

To change the name, description or rules, select **Edit**.

## Freeze a dynamic segment

The **Freeze** menu on a dynamic segment offers two options:

| Option                     | What happens                                                                                                              |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| **Snapshot to new static** | Creates a new static segment, named after this one and dated today, holding today's matches. The original keeps updating. |
| **Convert to static**      | Turns this segment into a static one in place. The contacts matching now become its fixed members.                        |

Both keep the rules, so you can re-run them later.

## Refresh a static segment

A static segment that was frozen from rules has a **Refresh** button. Refreshing runs the rules
again and replaces the current members with today's matches.

<Warning>
  Refresh throws away any contacts you added or removed by hand since the last freeze. Editing the
  filter alone doesn't change the members; the new filter applies at the next refresh.
</Warning>

A static segment with no rules has no **Refresh** button. You manage its members from the
**Contacts** tab.

## Troubleshooting

<AccordionGroup>
  <Accordion title="A segment with this name already exists" icon="circle-alert">
    **Why:** segment names are unique within an organization, including snapshot names.
    **Fix:** choose a different name, or rename the older segment.
  </Accordion>

  <Accordion title="My dynamic segment shows 0 contacts" icon="circle-alert">
    **Why:** either the segment has no rules, or no contact matches all of them.
    **Fix:** open the **Rules** tab and check each rule. With **All (AND)**, a single rule no one
    matches empties the segment; try **Any (OR)** to see which rules match.
  </Accordion>

  <Accordion title="The count didn't change after I edited a contact" icon="circle-alert">
    **Why:** dynamic counts are cached for up to 30 seconds, and static segments never change on
    their own. **Fix:** reopen the segment after half a minute. For a static segment, select
    **Refresh** to re-run its rules.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Create a campaign" icon="square-pen" href="/campaigns/create-a-campaign#choose-the-audience">
    Send a campaign to a segment, with lists and exclusions.
  </Card>

  <Card title="Lists" icon="list" href="/contacts/lists">
    The other kind of audience, and how it differs from a segment.
  </Card>

  <Card title="Export contacts" icon="upload" href="/contacts/importing#export-contacts">
    Download the contacts in a segment.
  </Card>
</Columns>
