Segments
A segment is an audience built from your own data. Someone who knows SQL saves a query against a connected database once, and anyone on the team can then build segments from it by adding filters, without writing SQL. When a broadcast is sent to a segment, DashX reads the segment's rows from your database as the broadcast starts sending, and messages everyone who matches, once each.
Open it from Messaging > Segments. The page lists your segments, with Active and Archived tabs, and below them the Queries section.
Connect your ClickHouse database in Database Hub. See ClickHouse.
Write a query
A query decides which data your segments can use. Every column it returns becomes a filter for segments built on it, and a placeholder in your messages.
- In the Queries section, click + (New query).
- Enter a Name and pick the Database.
- Write a single
SELECT(or a query starting withWITH). - Click Run, or press Cmd+Enter, to see the first 50 rows. Nothing is saved yet.
- Click Save.
SELECT email, phone, first_name, company_name, plan, renews_on
FROM crm.contacts
- No id column needed. DashX adds a key to each row itself.
- Return what you want to filter on. Include every column people will filter on or use in messages, such as
planorrenews_on. - Rename columns with
AS. The column names become filter names and placeholders. If two columns would end up with the same name, the query can't be saved until you give one of them another alias. - After a run, the editor shows which columns look like email addresses or phone numbers.
- Use the format button to tidy the SQL, and the expand button for a taller editor.
Queries can be saved for ClickHouse databases only, and only queries that read data. The database can't be changed once the query is saved.
Previews and counts read the database connection of the environment you have selected. A broadcast reads the connection of the environment it sends from.
Saved queries don't take variables such as {{plan}}. Return the column instead and filter on it in a segment. For example, rather than WHERE plan = {{plan}}, return plan and add the filter plan is Pro to the segment.
Queries are saved only under Messaging > Segments > Queries. SQL you run in Database Hub can't be used for a segment until you save it here.
Edit a query
Click a query's name, or its edit action, to open Edit Query. Editing a query changes what every segment built on it reads from then on.
The top of the editor lists what uses the query: its segments, and any draft or scheduled broadcasts that send to them. After you run your changes, the column list marks each column as new, removed or type changed compared with the saved query, and names the segments that filter on a removed or changed column and the broadcasts that send to it.
DashX won't save a query that stops returning a column that:
- a segment filters on. Change the segment's filters first.
- a draft or scheduled broadcast reads its email addresses or phone numbers from. Pick another column on the broadcast first.
Delete a query
A query can't be deleted while any segment, active or archived, is built on it. Delete those segments or build them on another query first.
Create a segment
- In the segments list, click + (New segment).
- Give it a Name. Each segment's name must be unique.
- In Built from, pick a saved query. You can't change this later.
- Add filters on the query's columns, for example plan is Pro.
- Click Save. The segment opens on its Filters tab, where you can change its filters later.
For most columns, a filter picks one or more values from a searchable list, which shows how many rows have each value. A row matches a filter when it has any of the picked values, and it must match every filter on the segment.
While you edit, the Filters tab shows a count of matching rows and the first 20 of them. Click a column header to sort the preview by that column. Click Refresh to read the latest data.
Export downloads every matching row as a CSV file. We email you when it's ready, and it's also listed under Messaging > Exports. It uses the saved filters, so save any changes first.
Filter on dates
Date and timestamp columns filter by a range instead of a list of values. Pick the start, the end or both. A timestamp range also takes times, read in your own timezone. The range is saved as fixed dates, so a broadcast sent later still uses the same range.
Segments on a resource
Built from also lists PostgreSQL tables synced as resources whose Account Lookup Attribute is set. Set it, and Account Lookup Matches (Account UID, Email or Phone), in the resource's settings. That's the column a broadcast uses to find each row's DashX account.
The segments list
| Column | Description |
|---|---|
| Name | Click it to open the segment. |
| Built From | The query or resource the segment reads. |
| Size | How many rows the segment matches right now. Click Show count to count them, since each count runs the query. |
| Sent To, Delivered, Opened, Clicked | What broadcasts sent to the segment reached, over all time, with delivery and open rates. |
| Last Sent | When a broadcast last sent to the segment. |
| Created By, Last Updated | Who created the segment, and when it last changed. |
Search by name, or click the refresh button to reload the list and the counts shown.
Archive a segment
Archive a segment you no longer send to, from its row's actions. Archived segments move to the Archived tab. They can't be added to a broadcast, and a draft broadcast that already sends to one can't be sent until you unarchive it.
Send a broadcast to a segment
- In the broadcast's recipients, add a new recipient and choose Dynamic Segment.
- Pick the Segment. Archived segments aren't listed.
- For email, SMS and WhatsApp broadcasts, pick the column that holds each row's address:
- Email column for email broadcasts
- Phone column for SMS and WhatsApp broadcasts
DashX guesses a likely column from the column names and the first rows. Check it before you send. The panel also shows how many rows the segment matches now and the first of them.
A segment can be added only as a To recipient, not as CC or BCC.
For each row of the segment:
| The row's address | What happens |
|---|---|
| Belongs to an existing DashX account | The message is sent through that account. |
| Doesn't belong to any account | The message is sent straight to the address as a direct contact, the same way an uploaded CSV row is. |
| Is empty | The row is skipped. |
Rows naming the same account or address are messaged once.
If the column holds phone numbers but the broadcast is an email, or the other way round, the segment fails with a message asking you to pick the column for the broadcast's channel.
Push and in-app broadcasts
Push and in-app messages need a DashX account to deliver to. These broadcasts can only use segments built on a resource that identifies accounts. Segments built on saved queries are hidden from them, since they can be sent by email, SMS or WhatsApp only.
Personalize messages
Every column of a segment's row is available in the template by its name, the same way an uploaded CSV's columns are. For example:
Hi {{first_name}}, your {{plan}} plan renews on {{renews_on}}.
- Column names that aren't plain identifiers, such as ones with spaces, need brackets:
{{[Who Pays]}}. - A few column names are taken by DashX, such as
email,phoneandlabel. Read those as{{record.email}},{{record.phone}}and{{record.label}}. Every column is also available this way.
After you pick a segment, the recipient panel lists the placeholders its columns give you.
When the broadcast sends
When you send the broadcast, DashX first builds its audience: it reads every segment in full, works out who each row reaches, and leaves out anyone who unsubscribed, is on one of the broadcast's exclusion lists, or can't be reached on the broadcast's channel. While this runs, the broadcast's status is BUILDING AUDIENCE.
The broadcast's Overview then shows the Audience, for example 1,250 recipients (12 excluded, 30 unsubscribed, 4 unreachable).
- Fresh data. The segment is read when the broadcast starts sending, so the audience reflects your data at that moment, not when you created or scheduled the broadcast.
- Large audiences wait for you. If a broadcast that sends to a segment has more than 10,000 recipients, nothing is sent until someone confirms it. The broadcast shows AWAITING CONFIRMATION, and its Overview offers Send to N recipients and Stop.
After the broadcast is sent, its Recipients tab lists everyone it reached, each marked with the segment they came through. Click the segment's name to see its filters.
Find broadcasts by segment
The Broadcasts list has a Segment column, and a Segment filter to show only broadcasts that send to the segments you pick. Broadcast exports include the Segment column too.
Segment analytics
Open a segment to see, on its Overview tab, what the broadcasts sent to it reached. Set the Date Range at the top; it starts on today.
| Section | What it shows |
|---|---|
| Audience | Sent To (each account once, and each direct address once per broadcast), Broadcasts, Skipped, and Messages per Person. |
| Engagement | Delivered, Opened, Clicked, Failed, Deferred, Unsubscribed and Complained, with their rates, plus Read and Dismissed when there are any. A funnel shows how messages moved from queued to clicked. |
| Engagement by Send Date | Messages sent, opened and clicked each day. Opens and clicks count on the day their message was sent. |
| Size at Each Send | The rows the segment matched, and how many of them were reached, each time a broadcast was sent. Shown once there are at least two sends. |
| By Channel | The same counts per channel. |
| Broadcasts | One row per broadcast: its channel, when it was sent, the Rows Matched at that send, and what it reached. Click a broadcast's name to open it. |
Rows Matched can be higher than Sent To: rows without a usable email or phone, and people who unsubscribed, aren't sent to. A person reached through two segments of the same broadcast counts under one of them. Only broadcasts you have access to are counted.
Example
Acme Corp's customer success team wants to remind its Pro customers about their renewal date.
-
A data analyst saves this query as Customer contacts:
SELECT email, first_name, company_name, plan, renews_onFROM crm.contacts -
The marketing team creates a segment named Pro customers, built from Customer contacts, with the filter plan is Pro.
-
They create an email broadcast, add a Dynamic Segment recipient for Pro customers, and check that the Email column is
email. -
The template says
Hi {{first_name}}, your plan renews on {{renews_on}}. -
When they send it, the Audience shows 85 recipients. A contact such as jane@example.com who has a DashX account gets the email through that account, and the rest get it as direct contacts.
-
A week later, the segment's Overview shows how many of them opened and clicked.