Переглянути джерело

chore(breakout-rooms) Added analytics (#10421)

master
Robert Pintilii 3 роки тому
джерело
коміт
0106e68728
Аккаунт користувача з таким Email не знайдено

+ 15
- 0
react/features/analytics/AnalyticsEvents.js Переглянути файл

@@ -884,3 +884,18 @@ export function createScreensharingCaptureTakenEvent() {
884 884
         action: 'screen.sharing.capture.taken'
885 885
     };
886 886
 }
887
+
888
+/**
889
+ * Creates an event for an action on breakout rooms.
890
+ *
891
+ * @param {string} actionSubject - The subject that was acted upon.
892
+ * @returns {Object} The event in a format suitable for sending via
893
+ * sendAnalytics.
894
+ */
895
+export function createBreakoutRoomsEvent(actionSubject) {
896
+    return {
897
+        action: 'clicked',
898
+        actionSubject: `${actionSubject}.button`,
899
+        source: 'breakout.rooms'
900
+    };
901
+}

+ 8
- 0
react/features/breakout-rooms/actions.js Переглянути файл

@@ -4,6 +4,7 @@ import i18next from 'i18next';
4 4
 import _ from 'lodash';
5 5
 import type { Dispatch } from 'redux';
6 6
 
7
+import { createBreakoutRoomsEvent, sendAnalytics } from '../analytics';
7 8
 import {
8 9
     conferenceLeft,
9 10
     conferenceWillLeave,
@@ -36,6 +37,8 @@ export function createBreakoutRoom(name?: string) {
36 37
         const index = Object.keys(rooms).length;
37 38
         const subject = name || i18next.t('breakoutRooms.defaultName', { index });
38 39
 
40
+        sendAnalytics(createBreakoutRoomsEvent('create'));
41
+
39 42
         // $FlowExpectedError
40 43
         getCurrentConference(getState)?.getBreakoutRooms()
41 44
             ?.createBreakoutRoom(subject);
@@ -54,6 +57,8 @@ export function closeBreakoutRoom(roomId: string) {
54 57
         const room = rooms[roomId];
55 58
         const mainRoom = getMainRoom(getState);
56 59
 
60
+        sendAnalytics(createBreakoutRoomsEvent('close'));
61
+
57 62
         if (room && mainRoom) {
58 63
             Object.values(room.participants).forEach(p => {
59 64
 
@@ -72,6 +77,8 @@ export function closeBreakoutRoom(roomId: string) {
72 77
  */
73 78
 export function removeBreakoutRoom(breakoutRoomJid: string) {
74 79
     return (dispatch: Dispatch<any>, getState: Function) => {
80
+        sendAnalytics(createBreakoutRoomsEvent('remove'));
81
+
75 82
         // $FlowExpectedError
76 83
         getCurrentConference(getState)?.getBreakoutRooms()
77 84
             ?.removeBreakoutRoom(breakoutRoomJid);
@@ -89,6 +96,7 @@ export function autoAssignToBreakoutRooms() {
89 96
         const breakoutRooms = _.filter(rooms, (room: Object) => !room.isMainRoom);
90 97
 
91 98
         if (breakoutRooms) {
99
+            sendAnalytics(createBreakoutRoomsEvent('auto.assign'));
92 100
             const participantIds = Array.from(getRemoteParticipants(getState).keys());
93 101
             const length = Math.ceil(participantIds.length / breakoutRooms.length);
94 102
 

+ 2
- 0
react/features/breakout-rooms/components/native/BreakoutRoomContextMenu.js Переглянути файл

@@ -6,6 +6,7 @@ import { TouchableOpacity } from 'react-native';
6 6
 import { Text } from 'react-native-paper';
7 7
 import { useDispatch, useSelector } from 'react-redux';
8 8
 
9
+import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
9 10
 import { hideDialog } from '../../../base/dialog/actions';
10 11
 import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
11 12
 import {
@@ -32,6 +33,7 @@ const BreakoutRoomContextMenu = ({ room }: Props) => {
32 33
     const { t } = useTranslation();
33 34
 
34 35
     const onJoinRoom = useCallback(() => {
36
+        sendAnalytics(createBreakoutRoomsEvent('join'));
35 37
         dispatch(moveToRoom(room.jid));
36 38
         closeDialog();
37 39
     }, [ dispatch, room ]);

+ 5
- 2
react/features/breakout-rooms/components/native/LeaveBreakoutRoomButton.js Переглянути файл

@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
5 5
 import { Button } from 'react-native-paper';
6 6
 import { useDispatch } from 'react-redux';
7 7
 
8
+import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
8 9
 import { moveToRoom } from '../../actions';
9 10
 
10 11
 import styles from './styles';
@@ -13,8 +14,10 @@ const LeaveBreakoutRoomButton = () => {
13 14
     const { t } = useTranslation();
14 15
     const dispatch = useDispatch();
15 16
 
16
-    const onLeave = useCallback(() =>
17
-        dispatch(moveToRoom())
17
+    const onLeave = useCallback(() => {
18
+        sendAnalytics(createBreakoutRoomsEvent('leave'));
19
+        dispatch(moveToRoom());
20
+    }
18 21
     , [ dispatch ]);
19 22
 
20 23
     return (

+ 2
- 0
react/features/breakout-rooms/components/web/JoinQuickActionButton.js Переглянути файл

@@ -5,6 +5,7 @@ import React, { useCallback } from 'react';
5 5
 import { useTranslation } from 'react-i18next';
6 6
 import { useDispatch } from 'react-redux';
7 7
 
8
+import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
8 9
 import { QuickActionButton } from '../../../base/components';
9 10
 import { moveToRoom } from '../../actions';
10 11
 
@@ -31,6 +32,7 @@ const JoinActionButton = ({ room }: Props) => {
31 32
 
32 33
     const onJoinRoom = useCallback(e => {
33 34
         e.stopPropagation();
35
+        sendAnalytics(createBreakoutRoomsEvent('join'));
34 36
         dispatch(moveToRoom(room.jid));
35 37
     }, [ dispatch, room ]);
36 38
 

+ 2
- 0
react/features/breakout-rooms/components/web/LeaveButton.js Переглянути файл

@@ -5,6 +5,7 @@ import React, { useCallback } from 'react';
5 5
 import { useTranslation } from 'react-i18next';
6 6
 import { useDispatch } from 'react-redux';
7 7
 
8
+import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
8 9
 import ParticipantPaneBaseButton from '../../../participants-pane/components/web/ParticipantPaneBaseButton';
9 10
 import { moveToRoom } from '../../actions';
10 11
 
@@ -28,6 +29,7 @@ export const LeaveButton = () => {
28 29
     const styles = useStyles();
29 30
 
30 31
     const onLeave = useCallback(() => {
32
+        sendAnalytics(createBreakoutRoomsEvent('leave'));
31 33
         dispatch(moveToRoom());
32 34
     }, [ dispatch ]);
33 35
 

+ 2
- 0
react/features/breakout-rooms/components/web/RoomContextMenu.js Переглянути файл

@@ -4,6 +4,7 @@ import React, { useCallback } from 'react';
4 4
 import { useTranslation } from 'react-i18next';
5 5
 import { useDispatch, useSelector } from 'react-redux';
6 6
 
7
+import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
7 8
 import { ContextMenu, ContextMenuItemGroup } from '../../../base/components';
8 9
 import {
9 10
     IconClose,
@@ -54,6 +55,7 @@ export const RoomContextMenu = ({
54 55
     const _overflowDrawer = useSelector(showOverflowDrawer);
55 56
 
56 57
     const onJoinRoom = useCallback(() => {
58
+        sendAnalytics(createBreakoutRoomsEvent('join'));
57 59
         dispatch(moveToRoom(room.id));
58 60
     }, [ dispatch, room ]);
59 61
 

+ 2
- 0
react/features/participants-pane/components/web/MeetingParticipantContextMenu.js Переглянути файл

@@ -2,6 +2,7 @@
2 2
 import { withStyles } from '@material-ui/styles';
3 3
 import React, { Component } from 'react';
4 4
 
5
+import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
5 6
 import { approveParticipant } from '../../../av-moderation/actions';
6 7
 import { Avatar } from '../../../base/avatar';
7 8
 import { ContextMenu, ContextMenuItemGroup } from '../../../base/components';
@@ -305,6 +306,7 @@ class MeetingParticipantContextMenu extends Component<Props> {
305 306
         return () => {
306 307
             const { _participant, dispatch } = this.props;
307 308
 
309
+            sendAnalytics(createBreakoutRoomsEvent('send.participant.to.room'));
308 310
             dispatch(sendParticipantToRoom(_participant.id, room.id));
309 311
         };
310 312
     }

+ 2
- 0
react/features/video-menu/components/native/SendToBreakoutRoom.js Переглянути файл

@@ -1,5 +1,6 @@
1 1
 // @flow
2 2
 
3
+import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
3 4
 import { translate } from '../../../base/i18n';
4 5
 import { IconRingGroup } from '../../../base/icons';
5 6
 import { isLocalParticipantModerator } from '../../../base/participants';
@@ -57,6 +58,7 @@ class SendToBreakoutRoom extends AbstractButton<Props, *> {
57 58
     _handleClick() {
58 59
         const { dispatch, participantID, room } = this.props;
59 60
 
61
+        sendAnalytics(createBreakoutRoomsEvent('send.participant.to.room'));
60 62
         dispatch(sendParticipantToRoom(participantID, room.id));
61 63
     }
62 64
 }

Завантаження…
Відмінити
Зберегти