Appearance
Targeting and segments
Targeting decides who sees a tour, announcement or survey. The backend applies it before content reaches the browser, so hidden content is never sent.
One model for tours, announcements and surveys
Every tour, announcement and survey has the same three parts. Each part is optional, and they all have to match.
| Part | What it does | Where it is checked |
|---|---|---|
| Audience | Only these segments (a visitor in any of them), Never these segments (a visitor in any of them never sees it), optional inline conditions, and new vs returning visitors. | Server, before content is sent. |
| Pages | Only on these pages and Never on these pages, each a list of rules. | The visitor's browser, on every page change. |
| Schedule | A start and end time. Tours only: announcements set theirs in the Schedule section of their Settings tab, surveys have none. | Server. |
Leaving a part empty means "no restriction": no segments and no rules show it to everyone, everywhere.
Page rules
Each rule has an operator and a value. A page is included when it matches any include rule (or when 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 | * stands for one path segment, ** for 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 that shows whether a URL would match.
Turn the SDK off on some pages
Use the excludePaths option when nothing from JustOneCX should show on a page (an admin area, a preview frame): it hides chat, tours, announcements, surveys and What's new there. To turn off one kind everywhere on a page, use disableTours, disableAnnouncements or disableSurveys.
A second copy of the SDK on the same page (a tag manager plus the npm package, for example) logs one warning and stays inactive, so chat and tours do not appear twice.
Where the data comes from
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().
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 a segment can use
| Attribute | What it reads |
|---|---|
| Role, Plan | The role and plan traits you send with 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 (called identify) 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 (from the browser or your server), at least N times, optionally in the last N days. |
| Completed tour / Dismissed tour | Whether the person finished or dismissed a tour (enter its key or id). |
| Answered survey / Saw announcement | Whether the person answered a survey or saw an announcement (key or id). |
| 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/last seen, MAU). The rest describe one person.
What is not a segment attribute: the page the visitor is on, their device, language and country. Those only exist in the browser, so they are checked there: use page rules for the current page and the SDK's context options for the rest. A segment is decided on the server before content is sent, so it cannot depend on them.
Groups
A segment is made of groups. Conditions inside a group combine with the group's Match all (every condition) or Match any (at least one). With two or more groups, the top-level choice decides how the groups combine: all groups or any group. This covers "(role is admin and plan is pro) or plan is free" without nesting further.
Segments made before groups existed were converted when you upgraded: a chain of AND conditions became one group, and a chain with OR was split at each OR into groups joined by any group. The old chain was evaluated strictly left to right, which groups cannot copy exactly, so check a segment that mixed AND and OR.
Operators
Each condition compares one attribute with a value. Which operators you can pick depends on the attribute.
| Operator | Meaning |
|---|---|
| equals / does not equal | Exact match (a date compares the day). |
| contains / does not contain | Text contains the value, ignoring case. |
| greater than / less than | Numbers, or dates for the signup date. |
| between | From and to, both included. |
| is set / is not set | The trait has a value / has none (an empty text counts as none). |
| within last N days / not within last N days | The signup date is that recent / older. |
Negative operators match people who have no value. "Plan does not equal pro" includes someone with no plan at all. Use is not set when you want to target people with a missing value on purpose, and is set to require one. "Account MAU less than 5" includes accounts and users with no activity, because they have an MAU of 0.
Keep traits fresh
Traits merge, so call identify and group on every page load. If you need targeted content to show right after a trait changes, await identify(...) and then call init() again.