Skip to Content
← Back to all demos

Events System

Comprehensive event system for tracking widget lifecycle and interactions

18+ event typesReal-time monitoringAnalytics integrationCustom handlers

Available Events

sessionStart

Fires when a new chat session is created. Includes sessionId and metadata.

sessionEnd

Fires when chat session ends. Includes duration and message count.

messageStart

User submitted a message. Includes message text and timestamp.

messageComplete

AI response completed. Includes full response text and queryId.

typing

User is typing. Fires with debounced updates for activity tracking.

typingStop

User stopped typing. Fires after 1 second of inactivity.

open

Widget opened by user. Includes sessionId and timestamp.

close

Widget closed by user. Includes sessionId and timestamp.

feedback

User submitted feedback (thumbs, stars, emoji). Includes rating and messageId.

copy

User copied message content. Includes content and messageId.

error

Error occurred. Includes type, message, and stack trace.

Trigger Test Events

Click buttons to trigger events and see them appear in the monitor:

Integration Code

// Initialize widget
const widget = window.NexusChatWidget.init({
  experienceId: "your-experience-id",
  apiUrl: "undefined"
});

// Listen to events
widget.on('sessionStart', (data) => {
  console.log('Session started:', data.sessionId);
});

widget.on('messageComplete', (data) => {
  console.log('AI response:', data.answer);
});

widget.on('feedback', (data) => {
  console.log('User feedback:', data.rating);
});

widget.on('error', (error) => {
  console.error('Error:', error.message);
});

🔴 Event Monitor

Events will appear here...

Use Cases

  • Analytics integration (Google Analytics, Mixpanel, Segment)
  • Custom UI updates and notifications
  • Session recording and replay
  • Performance monitoring and debugging
  • A/B testing and experimentation
  • CRM integration (sync chat history)
  • Error tracking (Sentry, Rollbar)