MeetSudo SDK - Chat, Analytics, Session Replay
npm install @meet-sudo/sdkOfficial JavaScript SDK for MeetSudo - the unified customer platform with chat, changelog, analytics, and session replay.
Documentation | Website | Dashboard
``bash`
npm install @meet-sudo/sdkor
yarn add @meet-sudo/sdkor
pnpm add @meet-sudo/sdk
`html`
`javascript
import { meetsudo } from '@meet-sudo/sdk';
// Initialize with your API key
meetsudo.init({
apiKey: 'your-api-key'
});
// Track events
meetsudo.track('button_clicked', { buttonId: 'signup' });
// Identify users
meetsudo.identify('user-123', {
email: 'user@example.com',
name: 'John Doe'
});
`
`html`
Initialize the SDK. Must be called before any other methods.
`typescript`
interface MeetSudoConfig {
apiKey: string; // Required: Your MeetSudo API key
apiUrl?: string; // Optional: API URL (default: https://api.meetsudo.com)
widgetUrl?: string; // Optional: Widget URL (default: https://widget.meetsudo.com)
disableChat?: boolean; // Optional: Disable chat widget
disableReplay?: boolean; // Optional: Disable session replay
disableEvents?: boolean; // Optional: Disable event tracking
disableAutoPageView?: boolean; // Optional: Disable automatic page view tracking
}
Identify a user with their unique ID and optional traits.
`javascript`
meetsudo.identify('user-123', {
email: 'user@example.com',
name: 'John Doe',
plan: 'pro',
signupDate: '2024-01-15'
});
Track a custom event with optional properties.
`javascript`
meetsudo.track('purchase_completed', {
orderId: 'ord-123',
amount: 99.99,
currency: 'USD'
});
Track a page view. Called automatically on init unless disableAutoPageView is set.
`javascript`
meetsudo.page({
title: 'Product Page',
category: 'E-commerce'
});
Control the chat widget programmatically.
`javascript
// Open the chat widget
meetsudo.chat('open');
// Close the chat widget
meetsudo.chat('close');
// Hide the chat widget
meetsudo.chat('hide');
// Show the chat widget
meetsudo.chat('show');
`
Control the "What's New" changelog tab in the widget.
`javascript
// Open the What's New tab
meetsudo.changelog('open');
// Close back to chat
meetsudo.changelog('close');
`
`javascript
// Check if SDK is initialized
meetsudo.isInitialized(); // boolean
// Get anonymous ID
meetsudo.getAnonymousId(); // string | null
// Get customer ID (after identify)
meetsudo.getCustomerId(); // string | null
`
The chat widget is automatically loaded if enabled in your MeetSudo dashboard. You can control it programmatically using the chat() method.
Publish product updates from the MeetSudo dashboard and they'll appear in the widget's "What's New" tab. Control it programmatically using the changelog() method.
Events are batched and sent every 5 seconds for optimal performance. On page unload, any remaining events are sent using keepalive fetch.
Session replay automatically captures user interactions for debugging and UX analysis. Sensitive inputs (passwords, credit cards) are automatically masked.
To exclude specific elements from recording:
`htmlSensitive content
TypeScript
Full TypeScript support is included. Types are exported from the main package:
`typescript
import type {
MeetSudoConfig,
UserTraits,
EventProperties,
PageProperties,
ChatAction,
ChangelogAction
} from '@meet-sudo/sdk';
``- Chrome 60+
- Firefox 55+
- Safari 11+
- Edge 79+
MIT