Skip to main content
The widget reports what it is doing by dispatching CustomEvents named sleek:{event} on document. $sleek.on() is a thin wrapper around addEventListener for those, so you can log an open, forward a submitted post to your own analytics, or react when a user signs in.

Register a listener

Call $sleek.on(event, callback). The callback receives the CustomEvent, and any payload is on event.detail.
string
required
The event name without the sleek: prefix. See the reference below.
function
required
Receives the CustomEvent. Read the payload from event.detail, never from the first argument directly.
The callback’s first argument is the event object, not the payload. function (view) { … } gives you a CustomEvent, not a view name. Always read event.detail.
Listeners are never removed by the SDK, including by shutdown(). If you need to detach one, register it with document.addEventListener yourself and keep the reference for removeEventListener.

Listen before the SDK loads

$sleek.on() only exists once the SDK script has run. To catch the earliest events, including init, use the native API with the sleek: prefix. This works from anywhere on the page, before or after the snippet.

Event reference

Lifecycle

loaded and widget_init both mark the iframe being ready, reported from the two sides of it. The iframe is only built the first time the widget is opened, so neither fires on a page where the visitor never opens the widget.
view is the widget’s route with the leading slash dropped, matching the view strings open() takes: feedback, feedback.48121, changelog, notifications, popup.satisfaction. The home screen reports an empty string. query is the route’s query parameters as an object.

Authentication

user_auth_set carries the visitor’s session token and profile. Do not log it or forward it to third parties.

Submissions

Popups

Capture tool

Use $sleek.loadTool() rather than these events directly; it handles both outcomes in one callback.

Examples

Track widget usage

Sync your own UI with the signed-in user

Handle a failed sign-in

SDK overview

Every method on $sleek, including push_trigger() for dispatching your own events.

Webhooks

Server-side notifications for the same activity, delivered to your backend.