fix(analytics) Fix analytics event names (#10332)

Fixed analytics where event names had duplicated words (eg. calendar.calendar.selected.selected)

Group reaction buttons analytics into one event

Removed unused code
This commit is contained in:
Robert Pintilii 2021-11-09 12:20:40 +02:00 committed by GitHub
parent e77216f18e
commit e0010def14
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 72 deletions

View File

@ -145,7 +145,6 @@ export function createCalendarClickedEvent(eventName, attributes = {}) {
export function createCalendarSelectedEvent(attributes = {}) {
return {
action: 'selected',
actionSubject: 'calendar.selected',
attributes,
source: 'calendar',
type: TYPE_UI
@ -161,8 +160,8 @@ export function createCalendarSelectedEvent(attributes = {}) {
*/
export function createCalendarConnectedEvent(attributes = {}) {
return {
action: 'calendar.connected',
actionSubject: 'calendar.connected',
action: 'connected',
actionSubject: 'calendar',
attributes
};
}
@ -214,7 +213,6 @@ export function createChromeExtensionBannerEvent(installPressed, attributes = {}
export function createRecentSelectedEvent(attributes = {}) {
return {
action: 'selected',
actionSubject: 'recent.list.selected',
attributes,
source: 'recent.list',
type: TYPE_UI
@ -535,12 +533,11 @@ export function createRejoinedEvent({ url, lastConferenceDuration, timeSinceLeft
export function createRemoteMuteConfirmedEvent(participantId, mediaType) {
return {
action: 'clicked',
actionSubject: 'remote.mute.dialog.confirm.button',
attributes: {
'participant_id': participantId,
'media_type': mediaType
},
source: 'remote.mute.dialog',
source: 'remote.mute.button',
type: TYPE_UI
};
}
@ -584,21 +581,6 @@ export function createRTCStatsTraceCloseEvent(closeEvent) {
return event;
}
/**
* Creates an event indicating that an action related to video blur
* occurred (e.g. It was started or stopped).
*
* @param {string} action - The action which occurred.
* @returns {Object} The event in a format suitable for sending via
* sendAnalytics.
*/
export function createVideoBlurEvent(action) {
return {
action,
actionSubject: 'video.blur'
};
}
/**
* Creates an event indicating that an action related to screen sharing
* occurred (e.g. It was started or stopped).
@ -631,26 +613,6 @@ export function createScreenSharingIssueEvent(attributes) {
};
}
/**
* The local participant failed to send a "selected endpoint" message to the
* bridge.
*
* @param {Error} error - The error which caused the failure.
* @returns {Object} The event in a format suitable for sending via
* sendAnalytics.
*/
export function createSelectParticipantFailedEvent(error) {
const event = {
action: 'select.participant.failed'
};
if (error) {
event.error = error.toString();
}
return event;
}
/**
* Creates an event associated with the "shared video" feature.
*
@ -688,7 +650,6 @@ export function createShortcutEvent(
attributes = {}) {
return {
action,
actionSubject: 'keyboard.shortcut',
actionSubjectId: shortcut,
attributes,
source: 'keyboard.shortcut',
@ -823,24 +784,6 @@ export function createToolbarEvent(buttonName, attributes = {}) {
};
}
/**
* Creates an event associated with reactions.
*
* @param {string} action - Event action.
* @param {string} name - Event name.
* @param {string} source - Event source.
* @returns {Object} The event in a format suitable for sending via
* sendAnalytics.
*/
function createReactionEvent(action, name, source) {
return {
action,
actionSubject: name,
source: `reaction.${source}`,
type: TYPE_UI
};
}
/**
* Creates an event associated with a reaction button being clicked/pressed.
*
@ -850,7 +793,13 @@ function createReactionEvent(action, name, source) {
* sendAnalytics.
*/
export function createReactionMenuEvent(buttonName) {
return createReactionEvent('clicked', buttonName, 'button');
return {
action: 'clicked',
actionSubject: 'button',
source: 'reaction',
buttonName,
type: TYPE_UI
};
}
/**
@ -860,7 +809,12 @@ export function createReactionMenuEvent(buttonName) {
* sendAnalytics.
*/
export function createReactionSoundsDisabledEvent() {
return createReactionEvent('disabled', 'sounds', 'settings');
return {
action: 'disabled',
actionSubject: 'sounds',
source: 'reaction.settings',
type: TYPE_UI
};
}
/**
@ -927,6 +881,6 @@ export function createWelcomePageEvent(action, actionSubject, attributes = {}) {
*/
export function createScreensharingCaptureTakenEvent() {
return {
action: 'screen.sharing.capture'
action: 'screen.sharing.capture.taken'
};
}

View File

@ -87,7 +87,7 @@ class AddMeetingUrlButton extends Component<Props> {
_onClick() {
const { calendarId, dispatch, eventId } = this.props;
sendAnalytics(createCalendarClickedEvent('calendar.add.url'));
sendAnalytics(createCalendarClickedEvent('add.url'));
dispatch(updateCalendarEvent(eventId, calendarId));
}

View File

@ -221,7 +221,7 @@ class CalendarList extends AbstractPage<Props> {
* @returns {void}
*/
_onOpenSettings() {
sendAnalytics(createCalendarClickedEvent('calendar.connect'));
sendAnalytics(createCalendarClickedEvent('connect'));
this.props.dispatch(openSettingsDialog(SETTINGS_TABS.CALENDAR));
}

View File

@ -117,7 +117,7 @@ class CalendarListContent extends Component<Props> {
* associated with this action.
* @returns {void}
*/
_onPress(url, analyticsEventName = 'calendar.meeting.tile') {
_onPress(url, analyticsEventName = 'meeting.tile') {
sendAnalytics(createCalendarClickedEvent(analyticsEventName));
this.props.dispatch(appNavigate(url));

View File

@ -109,7 +109,7 @@ class CalendarListContent extends Component<Props> {
_onJoinPress(event, url) {
event.stopPropagation();
this._onPress(url, 'calendar.meeting.join');
this._onPress(url, 'meeting.join');
}
_onPress: (string, ?string) => Function;
@ -123,7 +123,7 @@ class CalendarListContent extends Component<Props> {
* associated with this action.
* @returns {void}
*/
_onPress(url, analyticsEventName = 'calendar.meeting.tile') {
_onPress(url, analyticsEventName = 'meeting.tile') {
sendAnalytics(createCalendarClickedEvent(analyticsEventName));
this.props.dispatch(appNavigate(url));

View File

@ -142,11 +142,11 @@ function AddPeopleDialog({
*/
useEffect(() => {
sendAnalytics(createInviteDialogEvent(
'invite.dialog.opened', 'dialog'));
'opened', 'dialog'));
return () => {
sendAnalytics(createInviteDialogEvent(
'invite.dialog.closed', 'dialog'));
'closed', 'dialog'));
};
}, []);

View File

@ -102,7 +102,7 @@ export default class AbstractRecentList<P: Props> extends AbstractPage<P> {
_onPress(url) {
const { dispatch } = this.props;
sendAnalytics(createRecentClickedEvent('recent.meeting.tile'));
sendAnalytics(createRecentClickedEvent('meeting.tile'));
dispatch(appNavigate(url));
}

View File

@ -56,7 +56,7 @@ export default class AbstractMuteVideoButton extends AbstractButton<Props, *> {
const { dispatch, participantID } = this.props;
sendAnalytics(createRemoteVideoMenuButtonEvent(
'mute.button',
'video.mute.button',
{
'participant_id': participantID
}));