Przeglądaj źródła

Merge pull request #2023 from jitsi/remote_menu_analytics

feat(remote_menu): Add analytics
j8
virtuacoplenny 7 lat temu
rodzic
commit
1996ac4e02

+ 8
- 0
react/features/remote-video-menu/components/KickButton.js Wyświetl plik

@@ -3,6 +3,7 @@ import React, { Component } from 'react';
3 3
 import { connect } from 'react-redux';
4 4
 
5 5
 import { translate } from '../../base/i18n';
6
+import JitsiMeetJS from '../../base/lib-jitsi-meet';
6 7
 import { kickParticipant } from '../../base/participants';
7 8
 
8 9
 import RemoteVideoMenuButton from './RemoteVideoMenuButton';
@@ -82,6 +83,13 @@ class KickButton extends Component {
82 83
     _onClick() {
83 84
         const { dispatch, onClick, participantID } = this.props;
84 85
 
86
+        JitsiMeetJS.analytics.sendEvent(
87
+            'remotevideomenu.kick',
88
+            {
89
+                value: 1,
90
+                label: participantID
91
+            }
92
+        );
85 93
         dispatch(kickParticipant(participantID));
86 94
 
87 95
         if (onClick) {

+ 9
- 0
react/features/remote-video-menu/components/MuteButton.js Wyświetl plik

@@ -3,6 +3,7 @@ import React, { Component } from 'react';
3 3
 import { connect } from 'react-redux';
4 4
 
5 5
 import { translate } from '../../base/i18n';
6
+import JitsiMeetJS from '../../base/lib-jitsi-meet';
6 7
 import { muteRemoteParticipant } from '../../base/participants';
7 8
 
8 9
 import RemoteVideoMenuButton from './RemoteVideoMenuButton';
@@ -96,6 +97,14 @@ class MuteButton extends Component {
96 97
     _onClick() {
97 98
         const { dispatch, onClick, participantID } = this.props;
98 99
 
100
+        JitsiMeetJS.analytics.sendEvent(
101
+            'remotevideomenu.mute',
102
+            {
103
+                value: 1,
104
+                label: participantID
105
+            }
106
+        );
107
+
99 108
         dispatch(muteRemoteParticipant(participantID));
100 109
 
101 110
         if (onClick) {

+ 50
- 2
react/features/remote-video-menu/components/RemoteControlButton.js Wyświetl plik

@@ -1,6 +1,7 @@
1 1
 import PropTypes from 'prop-types';
2 2
 import React, { Component } from 'react';
3 3
 
4
+import JitsiMeetJS from '../../base/lib-jitsi-meet';
4 5
 import { translate } from '../../base/i18n';
5 6
 
6 7
 import RemoteVideoMenuButton from './RemoteVideoMenuButton';
@@ -50,6 +51,19 @@ class RemoteControlButton extends Component {
50 51
         t: PropTypes.func
51 52
     };
52 53
 
54
+    /**
55
+     * Initializes a new {@code RemoteControlButton} instance.
56
+     *
57
+     * @param {Object} props - The read-only React Component props with which
58
+     * the new instance is to be initialized.
59
+     */
60
+    constructor(props) {
61
+        super(props);
62
+
63
+        // Bind event handlers so they are only bound once for every instance.
64
+        this._onClick = this._onClick.bind(this);
65
+    }
66
+
53 67
     /**
54 68
      * Implements React's {@link Component#render()}.
55 69
      *
@@ -58,7 +72,6 @@ class RemoteControlButton extends Component {
58 72
      */
59 73
     render() {
60 74
         const {
61
-            onClick,
62 75
             participantID,
63 76
             remoteControlState,
64 77
             t
@@ -92,9 +105,44 @@ class RemoteControlButton extends Component {
92 105
                 displayClass = { className }
93 106
                 iconClass = { icon }
94 107
                 id = { `remoteControl_${participantID}` }
95
-                onClick = { onClick } />
108
+                onClick = { this._onClick } />
96 109
         );
97 110
     }
111
+
112
+    /**
113
+     * Sends analytics event for pressing the button and executes the passed
114
+     * onClick handler.
115
+     *
116
+     * @private
117
+     * @returns {void}
118
+     */
119
+    _onClick() {
120
+        const { onClick, participantID, remoteControlState } = this.props;
121
+
122
+        let eventName;
123
+
124
+        if (remoteControlState === REMOTE_CONTROL_MENU_STATES.STARTED) {
125
+            eventName = 'stop';
126
+        }
127
+
128
+        if (remoteControlState === REMOTE_CONTROL_MENU_STATES.NOT_STARTED) {
129
+            eventName = 'start';
130
+        }
131
+
132
+        if (eventName) {
133
+            JitsiMeetJS.analytics.sendEvent(
134
+                `remotevideomenu.remotecontrol.${eventName}`,
135
+                {
136
+                    value: 1,
137
+                    label: participantID
138
+                }
139
+            );
140
+        }
141
+
142
+        if (onClick) {
143
+            onClick();
144
+        }
145
+    }
98 146
 }
99 147
 
100 148
 export default translate(RemoteControlButton);

Ładowanie…
Anuluj
Zapisz