User segmentation for SaaS: segments, conditions and page rules
A segment is a saved group of people defined by conditions on the data you send, such as plan, role, events performed or signup date. In JustOneCX you use a segment to decide who sees a tour, announcement or survey. The server applies the audience before content is sent, so hidden content never reaches the browser.
This guide follows the targeting guide.
What data feeds a segment?
Segments read the data you send with three SDK calls.
identify()sets user traits such asplanandrole.group()sets account traits.track()records events.
identify("user-42", { role: "admin", plan: "growth" });
group("acme-inc", { plan: "growth", seats: 12 });
track("clicked_upgrade_cta", { plan: "growth" });
Traits merge, so call identify and group on every page load to keep them fresh. If targeted content must show right after a trait changes, await identify(...) and then call init() again. See identify users with the SDK and the API reference.
An anonymous visitor who never calls these still matches page rules, schedules and new-vs-returning rules. Segments and inline conditions need trait data. An account-level segment never matches a visitor who has not called group().
How do you create a segment?
- Open Segments in the dashboard.
- Define conditions on the traits you send with
identifyandgroup. - Use the segment in a tour, announcement or survey.
What can a segment use?
| Attribute | What it reads |
|---|---|
| Role, Plan | The role and plan traits from identify. |
| Custom trait | Any trait you send with identify (enter its key). |
| Account trait | A trait you send with group (enter its key). |
| Identified | Whether the person has a user id or is anonymous. |
| Signup date, First seen, Last seen | When the person or account was first and last seen. |
| Account MAU | Distinct active users of the account in the last 30 days. |
| Performed event / Never performed event | Whether the person sent an event, at least N times, optionally in the last N days. |
| Completed tour / Dismissed tour | Whether the person finished or dismissed a tour. |
| Answered survey / Saw announcement | Whether the person answered a survey or saw an announcement. |
| Opened chat, Chat rating | Whether the person started a chat, and whether they rated one at most N out of 5. |
A segment that measures accounts can only use the account-level attributes: traits, signup, first and last seen, and MAU.
The page, device, language and country are not segment attributes. They exist only in the browser. Use page rules for the current page.
How do groups and operators work?
A segment is made of groups. Conditions inside a group combine with Match all or Match any. With two or more groups, the top-level choice decides how groups combine: all groups or any group. This covers "(role is admin and plan is pro) or plan is starter".
Operators include equals, does not equal, contains, greater than, less than, between, is set, is not set, and within last N days.
One trap: negative operators match people who have no value. "Plan does not equal pro" includes someone with no plan at all. Use is not set or is set when you mean a missing value on purpose.
How do you target new vs returning visitors?
Every tour, announcement and survey has an audience part. Besides segments and inline conditions, it lets you target new vs returning visitors. This works for anonymous visitors too, because it does not need trait data.
What do "Only these segments" and "Never these segments" do?
- Only these segments: a visitor in any of them sees the content.
- Never these segments: a visitor in any of them never sees it.
You can combine both with inline conditions. Every part you fill in has to match. Leaving a part empty means no restriction. No segments and no rules show the content to everyone, everywhere.
How do page rules work?
Page rules are the second part of targeting. You set Only on these pages and Never on these pages, each a list of rules. A page is included when it matches any include rule (or there are none) and matches no exclude rule.
| Operator | Matches |
|---|---|
| is exactly | The path equals the value. |
| starts with | The path starts with the value. |
| contains | The path contains the value. |
| matches pattern | * is one path segment, ** is any depth: /projects/*/settings, /docs/**. |
| matches regex | A regular expression on the path. An invalid expression never matches. |
The query string and #hash are ignored unless you tick query or #hash on the rule. The builder has a Test a URL box to check a match.
Where is each part checked?
| Part | Checked |
|---|---|
| Audience | On the server, before content is sent. |
| Pages | In the visitor's browser, on every page change. |
| Schedule | On the server. |
Because the audience is decided on the server, hidden content is never sent. Page rules run in the browser because the current page only exists there. Schedules for tours are set in targeting. Announcements set theirs in the Schedule section of their Settings tab. Surveys have none.
How do you put segments to work?
Pick one behaviour you care about and target it. For example, show an announcement only to accounts on a plan that includes the new feature, or show a tour to people who have never performed the key event. See in-app announcement best practices and how to measure feature adoption.
Frequently asked questions
Where is the audience decided?
On the server, before content is sent. Hidden content is never sent to the browser.
Can I segment by device or country?
No. The page, device, language and country exist only in the browser, so they are not segment attributes. Use page rules for the current page.
Does "plan does not equal pro" include people with no plan?
Yes. Negative operators match people who have no value. Use is not set or is set to target a missing value on purpose.
Do anonymous visitors match segments?
Segments and inline conditions need trait data. Anonymous visitors still match page rules, schedules and new-vs-returning rules.
See how it works in the live demo.