Track events
Tell Usercase about moments the screen does not show, like work finishing on your server. Then ask a question when they happen.
Usercase.track(name)
track sends only the event name and the time. It does not send properties or who the visitor is.
Usercase.track("recording stopped"); // later, when your server is done Usercase.track("transcript ready"); // or, if it failed Usercase.track("transcript failed");
Event names
- Up to 64 characters: letters, numbers, spaces and
_ - . : /. Case and extra spaces are ignored when matching. - Name what happened, not who or which item. Names with an email, a UUID or a long number are dropped.
- Up to 200 events are sent per page.
- If visitors must consent first, events before
Usercase.consent(true)are dropped.
Calling track before the script loads
With npm (usercase 1.0.3 or later), track is safe to call before or after init. With the script tag, window.Usercase.track exists once the script has loaded. If you may call it earlier, add this line to the install code, after w.Usercase.project. Events are kept until the script loads.
w.Usercase.track = w.Usercase.track || function (n) { (w.Usercase.trackQueue = w.Usercase.trackQueue || []).push({ name: n, ts: Date.now() }); };
Ask about an event
In the dashboard, open Live questions → + New question and choose After an event under When. Events work on every page. Then pick how to ask:
| How to ask | For example |
|---|---|
| Right away | Ask what went wrong right after transcript failed. |
| If another doesn’t come in time | recording stopped, then no transcript ready within 5 minutes. Visitors can move to other pages meanwhile. If they leave your site first, they aren’t asked. |
| Once another also comes | Ask people who got their transcript: recording stopped, then transcript ready in the same visit. |
| The Nth time it happens | The 3rd export failed in one visit. 30 minutes away starts a new visit. |
| If they leave before another comes | They leave the page before transcript ready: moving to another page, closing the tab, or coming back from another tab. Phones can’t tell when someone closes the tab. |
Pick a first event close to the second one. recording stopped works better than recording started, because meetings have different lengths.
Events only
Turn on Events only in Settings → Installation to collect nothing automatically. Usercase then receives only:
- the events you send with
track, without the page they happened on - the answers to your questions
Clicks, scrolls, typing, page addresses, page titles, screen text, device details, referrers and session replays are not sent. Questions still work: make them with When › After an event.