ソースを参照

feat(vpaas): Track vpaas conference join

master
Vlad Piersec 5年前
コミット
9fbb35b6e1

+ 16
- 0
react/features/analytics/AnalyticsEvents.js ファイルの表示

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
  * Creates an event for an action on the welcome page.
792
  * Creates an event for an action on the welcome page.
777
  *
793
  *

+ 22
- 1
react/features/billing-counter/middleware.js ファイルの表示

1
+import { sendAnalytics, createVpaasConferenceJoinedEvent } from '../analytics';
2
+import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
1
 import { PARTICIPANT_JOINED } from '../base/participants/actionTypes';
3
 import { PARTICIPANT_JOINED } from '../base/participants/actionTypes';
2
 import { MiddlewareRegistry } from '../base/redux';
4
 import { MiddlewareRegistry } from '../base/redux';
3
 
5
 
4
 import { SET_BILLING_ID } from './actionTypes';
6
 import { SET_BILLING_ID } from './actionTypes';
5
 import { countEndpoint } from './actions';
7
 import { countEndpoint } from './actions';
6
-import { setBillingId } from './functions';
8
+import { isVpaasMeeting, extractVpaasTenantFromPath, setBillingId } from './functions';
7
 
9
 
8
 /**
10
 /**
9
  * The redux middleware for billing counter.
11
  * The redux middleware for billing counter.
14
 
16
 
15
 MiddlewareRegistry.register(store => next => async action => {
17
 MiddlewareRegistry.register(store => next => async action => {
16
     switch (action.type) {
18
     switch (action.type) {
19
+    case CONFERENCE_JOINED: {
20
+        _maybeTrackVpaasConferenceJoin(store.getState());
21
+
22
+        break;
23
+    }
17
     case SET_BILLING_ID: {
24
     case SET_BILLING_ID: {
18
         setBillingId(action.value);
25
         setBillingId(action.value);
19
 
26
 
34
 
41
 
35
     return next(action);
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
+}

読み込み中…
キャンセル
保存