Concepts
Triggers
[object Object]
| Trigger | Starts when | Spec |
|---|---|---|
| First visit | The SDK runs for the first time for this user | { "type": "first_visit", "once": true } |
| Page or screen | A path (web) or route name (Flutter) matches | { "type": "page_view", "path": "/invoices/*", "once": true } |
| Event | Your app reports an event with track | { "type": "event", "name": "invoice_page_opened", "once": true } |
| Manual | Your code calls start, or the user picks it in the launcher | { "type": "manual" } |
once (default true) means the guide starts at most once per user. A user can always replay it from the launcher, and start() always starts it.
Paths
* matches any run of characters: /invoices/* matches /invoices/new and /invoices/42/edit. On Flutter, paths are route names, so name your routes (settings: RouteSettings(name: '/invoices')) or call PlayStep.page('/invoices').
Events
Events are names you choose, like invoice_page_opened. Report them from your code:
TypeScript
playstep.track('invoice_page_opened')
The same event can start one guide and complete a step of another.
Targeting
A guide only starts for users who match its targeting:
- Platforms: web, Flutter or both.
- Segments: rules on the traits you pass to
identify. All rules must match.
TypeScript
playstep.identify(user.id, { plan: 'pro', guides: 0 })
JSON
{ "segments": [{ "trait": "plan", "op": "eq", "value": "pro" }] }
Operators are eq, neq, in (any of a list) and exists. When several guides match at once, the first one in the published order starts; the others wait.