# Segments

> Define reusable groups of players from spend, playtime, player properties, events or saved lists, and use them to filter analytics across the app.

A segment is a saved rule that picks out a group of players, such as "spent more than 5,000 Robux" or "opened the shop but never bought anything". Once saved, you can filter Explore, dashboards, funnels, retention and the player explorer by it, and compare segments side by side.

Segments are built from the player data the Luau SDK collects, so the **Segments** page is only available once the SDK is installed. See [install the SDK](https://docs.bloxlytics.app/projects/install-the-sdk).

Anyone with **View analytics** can see segments and their player counts. Creating, editing and deleting them needs **Create funnels, segments, dashboards, experiments and alerts** (`analytics.configure`).

## The segments list

**Segments** in the project sidebar lists every saved segment with:

- its name, and its description or a one-line summary of its conditions;
- **Players**: how many players match now, and their share of all tracked players;
- when it was last updated, and a **Players** link that opens the [player explorer](https://docs.bloxlytics.app/analytics/players) filtered to it.

Tick two to four segments and select **Compare** to [compare them](#compare-segments).

## Create a segment

Select **New segment**, then **Blank segment** or one of the templates:

| Template | Description | Condition |
| --- | --- | --- |
| Whales | Spent more than 5,000 Robux | Total Robux spent > 5,000 |
| New players | First joined within 24 hours | First joined (hours ago) ≤ 24 |
| At risk | Last seen more than five days ago | Last seen (days ago) > 5 |
| Highly engaged | More than 10 hours of playtime | Total playtime (hours) > 10 |
| Non-converting | Opened the shop but never purchased | Performed `ShopOpened` and Purchases = 0 |

The Non-converting template assumes your game sends a custom event called `ShopOpened`. Change the event to whatever yours is called.

Give the segment a **Name** (up to 80 characters) and an optional **Description** (up to 240), build the conditions, and select **Save segment**.

### Live preview

While you edit, the **Matching players** panel recalculates about half a second after each change:

- the number of matching players and their share of all tracked players;
- **Active in the last 7 days**: how many of them played in the past week;
- **Total Robux spent** by the group;
- **Average playtime**: total playtime per player;
- **Average sessions** per player.

If a condition is incomplete, the panel says "Complete the conditions to preview."

## Conditions and groups

A segment is one or more **groups**, each holding one or more **conditions**.

- Within a group, **Match all conditions** requires every condition to be true (AND); **Match any conditions** requires at least one (OR).
- With more than one group, **Players must match all of these groups** (AND) or **any of these groups** (OR).

Use **Add condition** and **Add group** to build it up. A segment can have up to 10 groups, each with up to 20 conditions. Each row starts with a condition type.

### Player metric

A number calculated from everything the SDK has recorded about the player, over their whole history:

| Metric | Meaning |
| --- | --- |
| Total Robux spent | Robux from completed purchases |
| Purchases | Number of completed purchases |
| Total playtime (hours) | All session time added up |
| Sessions | Number of sessions |
| First joined (hours ago) | Time since their first session, in hours |
| Last seen (days ago) | Time since they were last seen, in days |
| Average session (minutes) | Total playtime divided by sessions |

Operators: `>`, `≥`, `<`, `≤`, `=` and `≠`. The two "ago" metrics are measured from the moment the segment is used, so a segment like "First joined (hours ago) ≤ 24" always means the last 24 hours. Both are fractional, so 36 hours ago is `36`, not rounded to a day.

### Player property

A property you set from your game with `SetPlayerProperty` or `SetPlayerProperties` (see [custom events](https://docs.bloxlytics.app/sdk/custom-events)), such as `Level` or `Guild`. The property box suggests keys seen recently.

- The player's latest value for the property is used.
- `>`, `≥`, `<` and `≤` compare numbers. Values that aren't numbers don't match.
- `=` and `≠` compare the value as exact text.
- `contains` is a case-insensitive text match.

Only players who have the property can match. A player who has never had `Guild` set doesn't match `Guild ≠ Red`.

### Event

Whether, or how often, the player has ever sent an event:

| Operator | Matches players who |
| --- | --- |
| performed | Sent the event at least once |
| never performed | Never sent it |
| count > *n* | Sent it more than *n* times |
| count < *n* | Sent it fewer than *n* times, including never |

The event list shows your custom events and the SDK's automatic events, apart from internal ones such as server heartbeats and balance snapshots. Counts cover the player's whole history.

### Player list

A fixed list of players rather than a rule. You can't add one by hand. It's created when you select **Save as segment** on a list of players elsewhere in the app:

- on a [funnel](https://docs.bloxlytics.app/analytics/funnels), for the players who reached one step but not the next;
- on [retention](https://docs.bloxlytics.app/analytics/retention), for a churn group such as **Never returned** or **Never purchased**.

A list holds up to 5,000 players; if more are selected, the first 5,000 are saved. The segment's description says where the list came from (for example "Reached “…” but not “…”."), and its condition reads "is one of *n* saved players". A static list never changes, even as those players come and go. You can add further conditions to it, for example to keep only list members who are still active.

## Worked example

Suppose you want "paying players at level 10 or above, plus anyone who has crafted more than 20 items". Build two groups and set **Players must match** to **any** of these groups:

**1. Group 1: match all conditions**

- **Player metric**: Total Robux spent `>` `0`
- **Player property**: `Level` `≥` `10`

**2. Group 2**

- **Event**: `<event name>` count `>` `20` times

The summary on the list then reads `(Total Robux spent > 0 and Level ≥ 10) or (count > <event name> 20)`.

## Where you can use segments

| Place | How |
| --- | --- |
| [Explore](https://docs.bloxlytics.app/analytics/explore) | **Segment** button in the filter bar |
| [Dashboards](https://docs.bloxlytics.app/analytics/dashboards) | The dashboard filter bar, and the **Segment** setting on KPI, line, bar, custom query, event, pie, funnel and retention widgets |
| [Player explorer](https://docs.bloxlytics.app/analytics/players) | The segment selector, or **View players** on a segment |
| [Funnels](https://docs.bloxlytics.app/analytics/funnels) | The **Segment** selector on a funnel |
| [Retention](https://docs.bloxlytics.app/analytics/retention) | The **Segment** selector above the cohorts |
| [Compare segments](#compare-segments) | Side by side |

Table, economy and live players widgets can't be limited to a segment; when a dashboard has one, they show that it was skipped. A segment combines with player filters by AND: players must be in the segment and match every filter.

Segments are always evaluated fresh. Editing a segment changes every chart, dashboard and digest that uses it from that moment.

> **Warning:** Deleting a segment doesn't affect players, but anything that filtered by it stops working. A saved Explore query that uses it shows "The segment in this query was deleted. Choose another or remove it." until you change it.

## Compare segments

The compare page puts two to four segments side by side. Open it from the list by ticking segments and selecting **Compare**, then add or remove segments with the checkboxes at the top.

The **Summary** table shows, for each segment:

| Row | Meaning |
| --- | --- |
| Players | Players matching now |
| Share of all players | Matching players as a share of all tracked players |
| Active in the last 7 days | Matching players who played in the past week |
| Total Robux spent | Robux the group has spent in total |
| Robux per player | Total Robux spent divided by players |
| Average playtime | Total playtime per player |
| Average sessions | Sessions per player |
| D1, D7 and D30 retention | Retention of the segment's players, see below |

Retention is the weighted average across cohorts of the segment's players who first joined during the **Retention range** (**30 days** or **90 days**). Cohorts too young to measure, such as D30 for players who joined last week, are left out. All other rows cover players' whole history.

Below the table, two charts show **Players** and **Robux per player** for each segment.

## Things to know

- Segments describe players, not sessions or events. Filtering a chart by a segment keeps everything those players did in the chart's date range.
- Segment membership is worked out from players' whole history at the moment you look. A segment such as "Last seen (days ago) > 5" can include players who were active earlier in a 30-day chart.
- Player metrics only count what the SDK has recorded since you installed it. Earlier purchases and playtime aren't included. See [purchases](https://docs.bloxlytics.app/sdk/purchases).
