AgentStack Docs
AgentStack Docs
AgentStack documentation
Get started
Build your agent
Actions
Analytics
Channels
Help Desk
Help Center
Developers
Embed the widgetControl the widgetListen for widget eventsBrowser integration boundariesClient-side formsREST API authenticationPagination and errorsRate limitsREST API: agent sign-upREST API: agentsREST API: sources and ingestionREST API: actionsREST API: channelsREST API: analytics and activityREST API: topicsREST API: contactsREST API: conversations and notesREST API: inbox and teamsREST API: chatREST API: roles and membersREST API: organizationREST API: API keysREST API: audit logsREST API: billingREST API: custom domainsREST API: domainsREST API: Help CenterREST API: Help PageREST API: Notion connectionREST API: voice callsIdentity verificationWebhooksMCP serverMCP scopesMCP toolsMCP clientsllms.txt
Workspace
    Developers

    Listen for widget events

    Measure and coordinate the embedded chat experience without scraping it.

    Widget events let the host page observe supported moments in an embedded conversation. The host page does not read private widget state or scrape rendered messages. Register listeners in the same step that creates the embed. When you remove the page or component, remove the listeners too. This practice avoids duplicate analytics when a single-page app navigates or remounts its chat launcher.

    You can use events for host-page concerns. Examples are opening a support panel, recording an interaction in your own analytics system, and adjusting the layout around the widget. Keep the event handler small and resilient. The handler must tolerate repeated notifications, late arrival after navigation, and an unavailable analytics provider. Do not infer answer quality, user identity, or a completed business action from a visual event alone.

    To store durable conversation data, get server-side authorization first. Then use the REST API or an approved MCP integration. Widget event payloads are not a substitute for API credentials. The embed must never expose an organization API key in browser JavaScript.

    Control the widget

    Coordinate supported widget behavior with the surrounding page.

    Browser integration boundaries

    Keep browser input, supported widget forms, and privileged server actions separate.