Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions react/features/analytics/AnalyticsEvents.js
Original file line number Diff line number Diff line change
Expand Up @@ -884,3 +884,18 @@ export function createScreensharingCaptureTakenEvent() {
action: 'screen.sharing.capture.taken'
};
}

/**
* Creates an event for an action on breakout rooms.
*
* @param {string} actionSubject - The subject that was acted upon.
* @returns {Object} The event in a format suitable for sending via
* sendAnalytics.
*/
export function createBreakoutRoomsEvent(actionSubject) {
return {
action: 'clicked',
actionSubject: `${actionSubject}.button`,
source: 'breakout.rooms'
};
}
8 changes: 8 additions & 0 deletions react/features/breakout-rooms/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import i18next from 'i18next';
import _ from 'lodash';
import type { Dispatch } from 'redux';

import { createBreakoutRoomsEvent, sendAnalytics } from '../analytics';
import {
conferenceLeft,
conferenceWillLeave,
Expand Down Expand Up @@ -36,6 +37,8 @@ export function createBreakoutRoom(name?: string) {
const index = Object.keys(rooms).length;
const subject = name || i18next.t('breakoutRooms.defaultName', { index });

sendAnalytics(createBreakoutRoomsEvent('create'));

// $FlowExpectedError
getCurrentConference(getState)?.getBreakoutRooms()
?.createBreakoutRoom(subject);
Expand All @@ -54,6 +57,8 @@ export function closeBreakoutRoom(roomId: string) {
const room = rooms[roomId];
const mainRoom = getMainRoom(getState);

sendAnalytics(createBreakoutRoomsEvent('close'));

if (room && mainRoom) {
Object.values(room.participants).forEach(p => {

Expand All @@ -72,6 +77,8 @@ export function closeBreakoutRoom(roomId: string) {
*/
export function removeBreakoutRoom(breakoutRoomJid: string) {
return (dispatch: Dispatch<any>, getState: Function) => {
sendAnalytics(createBreakoutRoomsEvent('remove'));

// $FlowExpectedError
getCurrentConference(getState)?.getBreakoutRooms()
?.removeBreakoutRoom(breakoutRoomJid);
Expand All @@ -89,6 +96,7 @@ export function autoAssignToBreakoutRooms() {
const breakoutRooms = _.filter(rooms, (room: Object) => !room.isMainRoom);

if (breakoutRooms) {
sendAnalytics(createBreakoutRoomsEvent('auto.assign'));
const participantIds = Array.from(getRemoteParticipants(getState).keys());
const length = Math.ceil(participantIds.length / breakoutRooms.length);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { TouchableOpacity } from 'react-native';
import { Text } from 'react-native-paper';
import { useDispatch, useSelector } from 'react-redux';

import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
import { hideDialog } from '../../../base/dialog/actions';
import BottomSheet from '../../../base/dialog/components/native/BottomSheet';
import {
Expand All @@ -32,6 +33,7 @@ const BreakoutRoomContextMenu = ({ room }: Props) => {
const { t } = useTranslation();

const onJoinRoom = useCallback(() => {
sendAnalytics(createBreakoutRoomsEvent('join'));
dispatch(moveToRoom(room.jid));
closeDialog();
}, [ dispatch, room ]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
import { Button } from 'react-native-paper';
import { useDispatch } from 'react-redux';

import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
import { moveToRoom } from '../../actions';

import styles from './styles';
Expand All @@ -13,8 +14,10 @@ const LeaveBreakoutRoomButton = () => {
const { t } = useTranslation();
const dispatch = useDispatch();

const onLeave = useCallback(() =>
dispatch(moveToRoom())
const onLeave = useCallback(() => {
sendAnalytics(createBreakoutRoomsEvent('leave'));
dispatch(moveToRoom());
}
, [ dispatch ]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';

import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
import { QuickActionButton } from '../../../base/components';
import { moveToRoom } from '../../actions';

Expand All @@ -31,6 +32,7 @@ const JoinActionButton = ({ room }: Props) => {

const onJoinRoom = useCallback(e => {
e.stopPropagation();
sendAnalytics(createBreakoutRoomsEvent('join'));
dispatch(moveToRoom(room.jid));
}, [ dispatch, room ]);

Expand Down
2 changes: 2 additions & 0 deletions react/features/breakout-rooms/components/web/LeaveButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';

import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
import ParticipantPaneBaseButton from '../../../participants-pane/components/web/ParticipantPaneBaseButton';
import { moveToRoom } from '../../actions';

Expand All @@ -28,6 +29,7 @@ export const LeaveButton = () => {
const styles = useStyles();

const onLeave = useCallback(() => {
sendAnalytics(createBreakoutRoomsEvent('leave'));
dispatch(moveToRoom());
}, [ dispatch ]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, { useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';

import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
import { ContextMenu, ContextMenuItemGroup } from '../../../base/components';
import {
IconClose,
Expand Down Expand Up @@ -54,6 +55,7 @@ export const RoomContextMenu = ({
const _overflowDrawer = useSelector(showOverflowDrawer);

const onJoinRoom = useCallback(() => {
sendAnalytics(createBreakoutRoomsEvent('join'));
dispatch(moveToRoom(room.id));
}, [ dispatch, room ]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { withStyles } from '@material-ui/styles';
import React, { Component } from 'react';

import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
import { approveParticipant } from '../../../av-moderation/actions';
import { Avatar } from '../../../base/avatar';
import { ContextMenu, ContextMenuItemGroup } from '../../../base/components';
Expand Down Expand Up @@ -305,6 +306,7 @@ class MeetingParticipantContextMenu extends Component<Props> {
return () => {
const { _participant, dispatch } = this.props;

sendAnalytics(createBreakoutRoomsEvent('send.participant.to.room'));
dispatch(sendParticipantToRoom(_participant.id, room.id));
};
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @flow

import { createBreakoutRoomsEvent, sendAnalytics } from '../../../analytics';
import { translate } from '../../../base/i18n';
import { IconRingGroup } from '../../../base/icons';
import { isLocalParticipantModerator } from '../../../base/participants';
Expand Down Expand Up @@ -57,6 +58,7 @@ class SendToBreakoutRoom extends AbstractButton<Props, *> {
_handleClick() {
const { dispatch, participantID, room } = this.props;

sendAnalytics(createBreakoutRoomsEvent('send.participant.to.room'));
dispatch(sendParticipantToRoom(participantID, room.id));
}
}
Expand Down