@moveo-ai/web-client 0.110.0-true.1 → 0.110.0-true.2

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 CHANGED
@@ -215,13 +215,20 @@ payload listed below.
215
215
  | `onNoUnreadMessages(cb)` | The unread indicator clears | — |
216
216
  | `onUserActivity(cb)` | The visitor interacts with the widget | — |
217
217
  | `onMemberLeave(cb)` | An agent leaves the conversation | — |
218
- | `onAnalyticsEvent(cb)` | Any interaction event (see below) | `{ timestamp, event, session_id?, properties }` |
218
+ | `onAnalyticsEvent(cb)` | The widget loads, and every interaction | `{ timestamp, event, session_id?, properties }` |
219
219
 
220
220
  `onAnalyticsEvent` receives every interaction the widget tracks, identified by
221
221
  the `event` field: `session_start`, `session_end`, `message_sent` (the user sent
222
222
  a message — never carries the text), `launcher_clicked`, `rating_submitted`, and
223
223
  the rest of the `AnalyticsEvent` enum in `src/hooks/useAnalytics.ts`.
224
224
 
225
+ It also receives one event that is not an interaction: **`widget_loaded`**,
226
+ raised as soon as the widget renders on the page. It carries no `session_id`,
227
+ because a session opens only when the visitor opens the chat. Register the
228
+ callback at any time — a callback added after the widget loaded still receives
229
+ `widget_loaded` on registration, so the event cannot be missed in the race
230
+ between `init()` resolving and your `.then()` running.
231
+
225
232
  ### Forward widget events into your analytics
226
233
 
227
234
  The widget never writes into your analytics tools. If you want chat activity in
@@ -232,9 +239,17 @@ and where. With Quantum Metric, for example:
232
239
  MoveoAI.init({ integrationId: 'YOUR_INTEGRATION_ID' }).then((controller) => {
233
240
  // Event ids must exist in your Quantum Metric configuration first:
234
241
  // sendEvent() silently drops ids that are not defined for the page.
235
- const QM_MOVEO_SESSION = 901; // example ids — define your own
242
+ const QM_MOVEO_LOADED = 900; // example ids — define your own
243
+ const QM_MOVEO_SESSION = 901;
236
244
  const QM_MOVEO_MESSAGE = 902;
237
245
 
246
+ controller.onAnalyticsEvent(({ event }) => {
247
+ if (event === 'widget_loaded') {
248
+ // Fires on every page that carries the widget, with no visitor action.
249
+ window.QuantumMetricAPI?.sendEvent(QM_MOVEO_LOADED, 0, '');
250
+ }
251
+ });
252
+
238
253
  controller.onSessionCreated(({ session_id }) => {
239
254
  // The Moveo session id becomes searchable on the QM session,
240
255
  // joining every replay to its Moveo conversation.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @moveo-ai/web-client v0.110.0-true.1
3
+ * @moveo-ai/web-client v0.110.0-true.2
4
4
  * Copyright (c) Moveo.ai (TM)
5
5
  *
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @moveo-ai/web-client v0.110.0-true.1
3
+ * @moveo-ai/web-client v0.110.0-true.2
4
4
  * Copyright (c) Moveo.ai (TM)
5
5
  *
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @moveo-ai/web-client v0.110.0-true.1
3
+ * @moveo-ai/web-client v0.110.0-true.2
4
4
  * Copyright (c) Moveo.ai (TM)
5
5
  *
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @moveo-ai/web-client v0.110.0-true.1
3
+ * @moveo-ai/web-client v0.110.0-true.2
4
4
  * Copyright (c) Moveo.ai (TM)
5
5
  *
6
6
  */
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @moveo-ai/web-client v0.110.0-true.1
3
+ * @moveo-ai/web-client v0.110.0-true.2
4
4
  * Copyright (c) Moveo.ai (TM)
5
5
  *
6
6
  */