Triggering guides from your own events
Start a guide at exactly the right moment, and complete steps when work is saved, with track().
6 minIntermediate
Page triggers are good for "first time on this page". Events are better for "right after they did X".
Start a guide from an event
Report the moment in your code:
playstep.track('first_invoice_sent')
In the guide's Settings, set Starts when to Your app sends an event and enter first_invoice_sent. Now a "Set up payment reminders" guide appears right after the first invoice goes out.
Complete a step when work is saved
A step that completes on tap finishes as soon as the button is tapped, even if saving fails. To wait for the result, use an event:
async function saveClient(form: ClientForm) {
await api.clients.create(form)
playstep.track('client_saved')
}
Set the step's Completes when to Your app sends an event, client_saved.
Start a guide from a help link
Guides with a manual trigger only start when you ask:
helpLink.addEventListener('click', () => playstep.start('payment-reminders'))
Naming events
Use past-tense facts in snake_case: invoice_sent, client_saved, receipts_opened. The same event can start one guide and complete a step of another.