Events

The widget dispatches native browser events on window. Listen for them to build your own analytics (for example Google Analytics / GTM) or to trigger custom behavior on your page.

Usage

Use the standard window.addEventListener API:

window.addEventListener('freeday:open', () => {
  gtag('event', 'chat_opened');
});

window.addEventListener('freeday:user-message-sent', () => {
  gtag('event', 'chat_first_message');
});

Event reference

Event Fires when Payload
freeday:open The user opens the chat — by clicking the launcher button, clicking a suggestion, or via the openChat() API. None
freeday:user-message-sent The user sends their first message in a conversation. Does not fire for later messages, or after resuming an existing conversation. None
freeday:close The chat window is closed. None
freeday:ready The widget has fully loaded and is ready for API calls like openChat(). Fires once — attach your listener before the widget script runs so you don't miss it. None

Deprecated events

freeday:start and freeday:toggle are legacy event names from earlier widget versions. They still fire for backwards compatibility, but are not part of the supported public contract — use freeday:open instead.