API Reference
SDK methods and auto-tracked events.
SDK Methods
HtmlAI.init(options)Initialize with custom config (apiKey, apiBaseUrl, trackingDomain, debug)
HtmlAI.track(eventName, componentId?, properties?)Track custom events with optional component context and properties
HtmlAI.getUser()Returns { user_id, session_id, global_uid }
HtmlAI.onSync(callback)Callback when cross-site identity sync completes
HtmlAI.flush()Force send all queued events immediately
Auto-tracked Events
The SDK automatically tracks these behavioral signals:
page_viewedPage load with URL and referrer
scroll_depth_reachedScroll depth percentage
scroll_fastRapid scrolling (>500px)
scroll_direction_changeDirection changes
rage_click3+ clicks in 500ms
dead_clickClick on non-interactive element
mouse_hesitationMouse idle for 2+ seconds
hoverHover on data-track-hover elements
tab_hidden / tab_visibleTab visibility changes
component_viewedai-opt component in view
For REST API documentation, see the FastAPI docs at /docs on the API server.