fix(welcome-page): send analytics on join

This commit is contained in:
Leonard Kim 2018-02-26 13:37:27 -08:00 committed by bgrozev
parent df9d17ba18
commit 9b04a7852a
2 changed files with 26 additions and 0 deletions

View File

@ -462,3 +462,22 @@ export const createTrackMutedEvent = function(mediaType, reason, muted = true) {
}
};
};
/**
* Creates an event for an action on the welcome page.
*
* @param {string} action - The action that the event represents.
* @param {string} actionSubject - The subject that was acted upon.
* @param {boolean} attributes - Additional attributes to attach to the event.
* @returns {Object} The event in a format suitable for sending via
* sendAnalytics.
*/
export const createWelcomePageEvent
= function(action, actionSubject, attributes = {}) {
return {
action,
actionSubject,
attributes,
source: 'welcomePage'
};
};

View File

@ -5,6 +5,7 @@ import { Component } from 'react';
import { appNavigate } from '../../app';
import { showAppSettings } from '../../app-settings';
import { createWelcomePageEvent, sendAnalytics } from '../../analytics';
import { isRoomValid } from '../../base/conference';
import { generateRoomWithoutSeparator } from '../functions';
@ -171,6 +172,12 @@ export class AbstractWelcomePage extends Component<*, *> {
_onJoin() {
const room = this.state.room || this.state.generatedRoomname;
sendAnalytics(
createWelcomePageEvent('clicked', 'joinButton', {
isGenerated: !this.state.room,
room
}));
if (room) {
this.setState({ joining: true });