Options
Example: Handling Callbacks
Render callback
Registeron_render in window.userpilotSettings.callbacks before the SDK script loads. It receives one event object for banners, cards, flow steps, spotlights, checklists, surveys, NPS, and the resource center. Every event includes type, id, and the mounted host-page element. Flow events use the step ID as id and also include flow_id. Survey events can run for each displayed module and include module_id.
height is the element’s getBoundingClientRect().height and excludes outside margins. The height can change later, so use a ResizeObserver on element if the host layout must keep tracking it. on_render is separate from userpilot.on('render', ...), which listens to flow events.
Type definitions
Troubleshooting
- “My callback doesn’t fire” – Ensure the SDK is initialized with
callbacksdefined before events occur. - “Socket events not showing” – Verify network connections and channel join logic.
- “Autocapture callback too noisy” – Combine with
excluded_elementsormasked_elementsto reduce unwanted triggers.