Browse Source

feat(vpaas): Track vpaas conference join

j8
Vlad Piersec 4 years ago
parent
commit
9fbb35b6e1

+ 16
- 0
react/features/analytics/AnalyticsEvents.js View File

@@ -772,6 +772,22 @@ export function createTrackMutedEvent(mediaType, reason, muted = true) {
772 772
     };
773 773
 }
774 774
 
775
+/**
776
+ * Creates an event for joining a vpaas conference.
777
+ *
778
+ * @param {string} tenant - The conference tenant.
779
+ * @returns {Object} The event in a format suitable for sending via
780
+ * sendAnalytics.
781
+ */
782
+export function createVpaasConferenceJoinedEvent(tenant) {
783
+    return {
784
+        action: 'vpaas.conference.joined',
785
+        attributes: {
786
+            tenant
787
+        }
788
+    };
789
+}
790
+
775 791
 /**
776 792
  * Creates an event for an action on the welcome page.
777 793
  *

+ 22
- 1
react/features/billing-counter/middleware.js View File

@@ -1,9 +1,11 @@
1
+import { sendAnalytics, createVpaasConferenceJoinedEvent } from '../analytics';
2
+import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
1 3
 import { PARTICIPANT_JOINED } from '../base/participants/actionTypes';
2 4
 import { MiddlewareRegistry } from '../base/redux';
3 5
 
4 6
 import { SET_BILLING_ID } from './actionTypes';
5 7
 import { countEndpoint } from './actions';
6
-import { setBillingId } from './functions';
8
+import { isVpaasMeeting, extractVpaasTenantFromPath, setBillingId } from './functions';
7 9
 
8 10
 /**
9 11
  * The redux middleware for billing counter.
@@ -14,6 +16,11 @@ import { setBillingId } from './functions';
14 16
 
15 17
 MiddlewareRegistry.register(store => next => async action => {
16 18
     switch (action.type) {
19
+    case CONFERENCE_JOINED: {
20
+        _maybeTrackVpaasConferenceJoin(store.getState());
21
+
22
+        break;
23
+    }
17 24
     case SET_BILLING_ID: {
18 25
         setBillingId(action.value);
19 26
 
@@ -34,3 +41,17 @@ MiddlewareRegistry.register(store => next => async action => {
34 41
 
35 42
     return next(action);
36 43
 });
44
+
45
+/**
46
+ * Tracks the conference join event if the meeting is a vpaas one.
47
+ *
48
+ * @param {Store} state - The app state.
49
+ * @returns {Function}
50
+ */
51
+function _maybeTrackVpaasConferenceJoin(state) {
52
+    if (isVpaasMeeting(state)) {
53
+        sendAnalytics(createVpaasConferenceJoinedEvent(
54
+            extractVpaasTenantFromPath(
55
+                state['features/base/connection'].locationURL.pathname)));
56
+    }
57
+}

Loading…
Cancel
Save