@meet-sudo/sdk 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Official JavaScript SDK for MeetSudo - the unified customer platform with chat, analytics, and session replay.
|
|
4
4
|
|
|
5
|
-
**[Documentation](https
|
|
5
|
+
**[Documentation](https://meetsudo.com/docs)** | **[Website](https://meetsudo.com)** | **[Dashboard](https://meetsudo.com/login)**
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ pnpm add @meet-sudo/sdk
|
|
|
19
19
|
### Script Tag (CDN)
|
|
20
20
|
|
|
21
21
|
```html
|
|
22
|
-
<script src="https://
|
|
22
|
+
<script src="https://unpkg.com/@meet-sudo/sdk/dist/meetsudo.global.js"></script>
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## Quick Start
|
|
@@ -27,18 +27,18 @@ pnpm add @meet-sudo/sdk
|
|
|
27
27
|
### ES Modules
|
|
28
28
|
|
|
29
29
|
```javascript
|
|
30
|
-
import {
|
|
30
|
+
import { meetsudo } from '@meet-sudo/sdk';
|
|
31
31
|
|
|
32
32
|
// Initialize with your API key
|
|
33
|
-
|
|
33
|
+
meetsudo.init({
|
|
34
34
|
apiKey: 'your-api-key'
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
// Track events
|
|
38
|
-
|
|
38
|
+
meetsudo.track('button_clicked', { buttonId: 'signup' });
|
|
39
39
|
|
|
40
40
|
// Identify users
|
|
41
|
-
|
|
41
|
+
meetsudo.identify('user-123', {
|
|
42
42
|
email: 'user@example.com',
|
|
43
43
|
name: 'John Doe'
|
|
44
44
|
});
|
|
@@ -47,13 +47,13 @@ await @meet-sudo/sdk.identify('user-123', {
|
|
|
47
47
|
### Script Tag
|
|
48
48
|
|
|
49
49
|
```html
|
|
50
|
-
<script src="https://
|
|
50
|
+
<script src="https://unpkg.com/@meet-sudo/sdk/dist/meetsudo.global.js"></script>
|
|
51
51
|
<script>
|
|
52
|
-
|
|
52
|
+
meetsudo.init({
|
|
53
53
|
apiKey: 'your-api-key'
|
|
54
|
-
}).then(function() {
|
|
55
|
-
MeetSudo.track('page_loaded');
|
|
56
54
|
});
|
|
55
|
+
|
|
56
|
+
meetsudo.track('page_loaded');
|
|
57
57
|
</script>
|
|
58
58
|
```
|
|
59
59
|
|
|
@@ -66,8 +66,8 @@ Initialize the SDK. Must be called before any other methods.
|
|
|
66
66
|
```typescript
|
|
67
67
|
interface MeetSudoConfig {
|
|
68
68
|
apiKey: string; // Required: Your MeetSudo API key
|
|
69
|
-
apiUrl?: string; // Optional: API URL (default: https://api
|
|
70
|
-
widgetUrl?: string; // Optional: Widget URL (default: https://widget
|
|
69
|
+
apiUrl?: string; // Optional: API URL (default: https://api.meetsudo.com)
|
|
70
|
+
widgetUrl?: string; // Optional: Widget URL (default: https://widget.meetsudo.com)
|
|
71
71
|
disableChat?: boolean; // Optional: Disable chat widget
|
|
72
72
|
disableReplay?: boolean; // Optional: Disable session replay
|
|
73
73
|
disableEvents?: boolean; // Optional: Disable event tracking
|
|
@@ -80,7 +80,7 @@ interface MeetSudoConfig {
|
|
|
80
80
|
Identify a user with their unique ID and optional traits.
|
|
81
81
|
|
|
82
82
|
```javascript
|
|
83
|
-
|
|
83
|
+
meetsudo.identify('user-123', {
|
|
84
84
|
email: 'user@example.com',
|
|
85
85
|
name: 'John Doe',
|
|
86
86
|
plan: 'pro',
|
|
@@ -93,7 +93,7 @@ await @meet-sudo/sdk.identify('user-123', {
|
|
|
93
93
|
Track a custom event with optional properties.
|
|
94
94
|
|
|
95
95
|
```javascript
|
|
96
|
-
|
|
96
|
+
meetsudo.track('purchase_completed', {
|
|
97
97
|
orderId: 'ord-123',
|
|
98
98
|
amount: 99.99,
|
|
99
99
|
currency: 'USD'
|
|
@@ -105,7 +105,7 @@ Track a custom event with optional properties.
|
|
|
105
105
|
Track a page view. Called automatically on init unless `disableAutoPageView` is set.
|
|
106
106
|
|
|
107
107
|
```javascript
|
|
108
|
-
|
|
108
|
+
meetsudo.page({
|
|
109
109
|
title: 'Product Page',
|
|
110
110
|
category: 'E-commerce'
|
|
111
111
|
});
|
|
@@ -117,29 +117,29 @@ Control the chat widget programmatically.
|
|
|
117
117
|
|
|
118
118
|
```javascript
|
|
119
119
|
// Open the chat widget
|
|
120
|
-
|
|
120
|
+
meetsudo.chat('open');
|
|
121
121
|
|
|
122
122
|
// Close the chat widget
|
|
123
|
-
|
|
123
|
+
meetsudo.chat('close');
|
|
124
124
|
|
|
125
125
|
// Hide the chat widget
|
|
126
|
-
|
|
126
|
+
meetsudo.chat('hide');
|
|
127
127
|
|
|
128
128
|
// Show the chat widget
|
|
129
|
-
|
|
129
|
+
meetsudo.chat('show');
|
|
130
130
|
```
|
|
131
131
|
|
|
132
132
|
### Helper Methods
|
|
133
133
|
|
|
134
134
|
```javascript
|
|
135
135
|
// Check if SDK is initialized
|
|
136
|
-
|
|
136
|
+
meetsudo.isInitialized(); // boolean
|
|
137
137
|
|
|
138
138
|
// Get anonymous ID
|
|
139
|
-
|
|
139
|
+
meetsudo.getAnonymousId(); // string | null
|
|
140
140
|
|
|
141
141
|
// Get customer ID (after identify)
|
|
142
|
-
|
|
142
|
+
meetsudo.getCustomerId(); // string | null
|
|
143
143
|
```
|
|
144
144
|
|
|
145
145
|
## Features
|
|
@@ -160,10 +160,10 @@ To exclude specific elements from recording:
|
|
|
160
160
|
|
|
161
161
|
```html
|
|
162
162
|
<!-- Using class -->
|
|
163
|
-
<div class="
|
|
163
|
+
<div class="ms-no-record">Sensitive content</div>
|
|
164
164
|
|
|
165
165
|
<!-- Using data attribute -->
|
|
166
|
-
<div data
|
|
166
|
+
<div data-ms-no-record>Sensitive content</div>
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
## TypeScript
|