diff --git a/Makefile b/Makefile index 7b1db6226..aea82dd33 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ deploy-appbundle: $(OUTPUT_DIR)/app.bundle.js $(OUTPUT_DIR)/app.bundle.js.map \ $(OUTPUT_DIR)/external_api.js.map $(OUTPUT_DIR)/external_api.js \ $(OUTPUT_DIR)/external_api.min.map $(OUTPUT_DIR)/external_api.min.js \ + $(OUTPUT_DIR)/analytics.js \ $(DEPLOY_DIR) deploy-lib-jitsi-meet: diff --git a/conference.js b/conference.js index 7672c4d7b..82148dee2 100644 --- a/conference.js +++ b/conference.js @@ -13,7 +13,6 @@ import CQEvents from './service/connectionquality/CQEvents'; import UIEvents from './service/UI/UIEvents'; import mediaDeviceHelper from './modules/devices/mediaDeviceHelper'; -import AnalyticsAdapter from './modules/statistics/AnalyticsAdapter'; import {reportError} from './modules/util/helpers'; @@ -896,7 +895,8 @@ export default { return this.useVideoStream(stream); }).then(() => { this.videoSwitchInProgress = false; - AnalyticsAdapter.sendEvent('conference.sharingDesktop.start'); + JitsiMeetJS.analytics.sendEvent( + 'conference.sharingDesktop.start'); console.log('sharing local desktop'); }).catch((err) => { this.videoSwitchInProgress = false; @@ -942,7 +942,8 @@ export default { ([stream]) => this.useVideoStream(stream) ).then(() => { this.videoSwitchInProgress = false; - AnalyticsAdapter.sendEvent('conference.sharingDesktop.stop'); + JitsiMeetJS.analytics.sendEvent( + 'conference.sharingDesktop.stop'); console.log('sharing local video'); }).catch((err) => { this.useVideoStream(null); @@ -1306,7 +1307,7 @@ export default { try { room.selectParticipant(id); } catch (e) { - AnalyticsAdapter.sendEvent('selectParticipant.failed'); + JitsiMeetJS.analytics.sendEvent('selectParticipant.failed'); reportError(e); } }); @@ -1331,7 +1332,7 @@ export default { APP.UI.addListener( UIEvents.VIDEO_DEVICE_CHANGED, (cameraDeviceId) => { - AnalyticsAdapter.sendEvent('settings.changeDevice.video'); + JitsiMeetJS.analytics.sendEvent('settings.changeDevice.video'); createLocalTracks({ devices: ['video'], cameraDeviceId: cameraDeviceId, @@ -1352,7 +1353,8 @@ export default { APP.UI.addListener( UIEvents.AUDIO_DEVICE_CHANGED, (micDeviceId) => { - AnalyticsAdapter.sendEvent('settings.changeDevice.audioIn'); + JitsiMeetJS.analytics.sendEvent( + 'settings.changeDevice.audioIn'); createLocalTracks({ devices: ['audio'], cameraDeviceId: null, @@ -1373,7 +1375,8 @@ export default { APP.UI.addListener( UIEvents.AUDIO_OUTPUT_DEVICE_CHANGED, (audioOutputDeviceId) => { - AnalyticsAdapter.sendEvent('settings.changeDevice.audioOut'); + JitsiMeetJS.analytics.sendEvent( + 'settings.changeDevice.audioOut'); APP.settings.setAudioOutputDeviceId(audioOutputDeviceId) .then(() => console.log('changed audio output device')) .catch((err) => { diff --git a/modules/UI/Feedback.js b/modules/UI/Feedback.js index cd7716cd0..5799bd8b7 100644 --- a/modules/UI/Feedback.js +++ b/modules/UI/Feedback.js @@ -1,6 +1,5 @@ -/* global $, APP, config, interfaceConfig */ +/* global $, APP, config, interfaceConfig, JitsiMeetJS */ import UIEvents from "../../service/UI/UIEvents"; -import AnalyticsAdapter from '../statistics/AnalyticsAdapter'; /** * Constructs the html for the overall feedback window. @@ -201,7 +200,7 @@ var Feedback = { = document.getElementById("feedbackTextArea").value; if (feedbackDetails && feedbackDetails.length > 0) { - AnalyticsAdapter.sendEvent( + JitsiMeetJS.analytics.sendEvent( 'feedback.rating', Feedback.feedbackScore); APP.conference.sendFeedback( Feedback.feedbackScore, feedbackDetails); @@ -231,7 +230,7 @@ var Feedback = { closeText: '', loaded: onLoadFunction, position: {width: 500}}, null); - AnalyticsAdapter.sendEvent('feedback.open'); + JitsiMeetJS.analytics.sendEvent('feedback.open'); }, /** * Toggles the appropriate css class for the given number of stars, to diff --git a/modules/UI/authentication/RoomLocker.js b/modules/UI/authentication/RoomLocker.js index 838074496..2e9c55715 100644 --- a/modules/UI/authentication/RoomLocker.js +++ b/modules/UI/authentication/RoomLocker.js @@ -1,7 +1,5 @@ /* global APP, JitsiMeetJS */ import UIUtil from '../util/UIUtil'; -//FIXME: -import AnalyticsAdapter from '../../statistics/AnalyticsAdapter'; /** * Show dialog which asks user for new password for the conference. @@ -152,7 +150,7 @@ export default function createRoomLocker (room) { return askToUnlock().then( () => { return lock(); } ).then(function () { - AnalyticsAdapter.sendEvent('toolbar.lock.disabled'); + JitsiMeetJS.analytics.sendEvent('toolbar.lock.disabled'); }).catch( reason => { if (reason !== APP.UI.messageHandler.CANCEL) @@ -170,7 +168,7 @@ export default function createRoomLocker (room) { return askForNewPassword().then( newPass => { return lock(newPass);} ).then(function () { - AnalyticsAdapter.sendEvent('toolbar.lock.enabled'); + JitsiMeetJS.analytics.sendEvent('toolbar.lock.enabled'); }).catch( reason => { if (reason !== APP.UI.messageHandler.CANCEL) diff --git a/modules/UI/recording/Recording.js b/modules/UI/recording/Recording.js index 7341bd1a3..5bea4de59 100644 --- a/modules/UI/recording/Recording.js +++ b/modules/UI/recording/Recording.js @@ -1,4 +1,4 @@ -/* global APP, $, config, interfaceConfig */ +/* global APP, $, config, interfaceConfig, JitsiMeetJS */ /* * Copyright @ 2015 Atlassian Pty Ltd * @@ -20,7 +20,6 @@ import VideoLayout from '../videolayout/VideoLayout'; import Feedback from '../Feedback.js'; import Toolbar from '../toolbars/Toolbar'; import BottomToolbar from '../toolbars/BottomToolbar'; -import AnalyticsAdapter from '../../statistics/AnalyticsAdapter'; /** * The dialog for user input. @@ -307,7 +306,7 @@ var Recording = { selector.click(function () { if (dialog) return; - AnalyticsAdapter.sendEvent('recording.clicked'); + JitsiMeetJS.analytics.sendEvent('recording.clicked'); switch (self.currentState) { case Status.ON: case Status.RETRYING: @@ -315,7 +314,8 @@ var Recording = { _showStopRecordingPrompt(recordingType).then( () => { self.eventEmitter.emit(UIEvents.RECORDING_TOGGLED); - AnalyticsAdapter.sendEvent('recording.stopped'); + JitsiMeetJS.analytics.sendEvent( + 'recording.stopped'); }, () => {}); break; @@ -326,13 +326,14 @@ var Recording = { _requestLiveStreamId().then((streamId) => { self.eventEmitter.emit( UIEvents.RECORDING_TOGGLED, {streamId: streamId}); - AnalyticsAdapter.sendEvent('recording.started'); + JitsiMeetJS.analytics.sendEvent( + 'recording.started'); }).catch( reason => { if (reason !== APP.UI.messageHandler.CANCEL) console.error(reason); else - AnalyticsAdapter.sendEvent( + JitsiMeetJS.analytics.sendEvent( 'recording.canceled'); } ); @@ -340,20 +341,22 @@ var Recording = { if (self.predefinedToken) { self.eventEmitter.emit( UIEvents.RECORDING_TOGGLED, {token: self.predefinedToken}); - AnalyticsAdapter.sendEvent('recording.started'); + JitsiMeetJS.analytics.sendEvent( + 'recording.started'); return; } _requestRecordingToken().then((token) => { self.eventEmitter.emit( UIEvents.RECORDING_TOGGLED, {token: token}); - AnalyticsAdapter.sendEvent('recording.started'); + JitsiMeetJS.analytics.sendEvent( + 'recording.started'); }).catch( reason => { if (reason !== APP.UI.messageHandler.CANCEL) console.error(reason); else - AnalyticsAdapter.sendEvent( + JitsiMeetJS.analytics.sendEvent( 'recording.canceled'); } ); diff --git a/modules/UI/shared_video/SharedVideo.js b/modules/UI/shared_video/SharedVideo.js index 761ed33d5..f873de0a5 100644 --- a/modules/UI/shared_video/SharedVideo.js +++ b/modules/UI/shared_video/SharedVideo.js @@ -1,4 +1,5 @@ -/* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError */ +/* global $, APP, YT, onPlayerReady, onPlayerStateChange, onPlayerError, +JitsiMeetJS */ import UIUtil from '../util/UIUtil'; import UIEvents from '../../../service/UI/UIEvents'; @@ -8,7 +9,6 @@ import LargeContainer from '../videolayout/LargeContainer'; import SmallVideo from '../videolayout/SmallVideo'; import FilmStrip from '../videolayout/FilmStrip'; import ToolbarToggler from "../toolbars/ToolbarToggler"; -import AnalyticsAdapter from '../../statistics/AnalyticsAdapter'; export const SHARED_VIDEO_CONTAINER_TYPE = "sharedvideo"; @@ -72,11 +72,11 @@ export default class SharedVideoManager { url => { this.emitter.emit( UIEvents.UPDATE_SHARED_VIDEO, url, 'start'); - AnalyticsAdapter.sendEvent('sharedvideo.started'); + JitsiMeetJS.analytics.sendEvent('sharedvideo.started'); }, err => { console.log('SHARED VIDEO CANCELED', err); - AnalyticsAdapter.sendEvent('sharedvideo.canceled'); + JitsiMeetJS.analytics.sendEvent('sharedvideo.canceled'); } ); return; @@ -86,7 +86,7 @@ export default class SharedVideoManager { showStopVideoPropmpt().then(() => { this.emitter.emit( UIEvents.UPDATE_SHARED_VIDEO, this.url, 'stop'); - AnalyticsAdapter.sendEvent('sharedvideo.stoped'); + JitsiMeetJS.analytics.sendEvent('sharedvideo.stoped'); }, () => {}); } else { @@ -98,7 +98,7 @@ export default class SharedVideoManager { dialog = null; } ); - AnalyticsAdapter.sendEvent('sharedvideo.alreadyshared'); + JitsiMeetJS.analytics.sendEvent('sharedvideo.alreadyshared'); } } @@ -202,7 +202,7 @@ export default class SharedVideoManager { self.smartAudioMute(); } else if (event.data == YT.PlayerState.PAUSED) { self.smartAudioUnmute(); - AnalyticsAdapter.sendEvent('sharedvideo.paused'); + JitsiMeetJS.analytics.sendEvent('sharedvideo.paused'); } self.fireSharedVideoEvent(event.data == YT.PlayerState.PAUSED); }; @@ -232,7 +232,7 @@ export default class SharedVideoManager { else if (event.data.volume <=0 || event.data.muted) { self.smartAudioUnmute(); } - AnalyticsAdapter.sendEvent('sharedvideo.volumechanged'); + JitsiMeetJS.analytics.sendEvent('sharedvideo.volumechanged'); }; window.onPlayerReady = function(event) { diff --git a/modules/UI/toolbars/BottomToolbar.js b/modules/UI/toolbars/BottomToolbar.js index 4ef781203..6dea1539c 100644 --- a/modules/UI/toolbars/BottomToolbar.js +++ b/modules/UI/toolbars/BottomToolbar.js @@ -1,7 +1,6 @@ -/* global $, APP, interfaceConfig*/ +/* global $, APP, interfaceConfig, JitsiMeetJS */ import UIUtil from '../util/UIUtil'; import UIEvents from '../../../service/UI/UIEvents'; -import AnalyticsAdapter from '../../statistics/AnalyticsAdapter'; const defaultBottomToolbarButtons = { 'chat': '#bottom_toolbar_chat', @@ -38,15 +37,17 @@ const BottomToolbar = { const buttonHandlers = { "bottom_toolbar_contact_list": function () { - AnalyticsAdapter.sendEvent('bottomtoolbar.contacts.toggled'); + JitsiMeetJS.analytics.sendEvent( + 'bottomtoolbar.contacts.toggled'); emitter.emit(UIEvents.TOGGLE_CONTACT_LIST); }, "bottom_toolbar_film_strip": function () { - AnalyticsAdapter.sendEvent('bottomtoolbar.filmstrip.toggled'); + JitsiMeetJS.analytics.sendEvent( + 'bottomtoolbar.filmstrip.toggled'); emitter.emit(UIEvents.TOGGLE_FILM_STRIP); }, "bottom_toolbar_chat": function () { - AnalyticsAdapter.sendEvent('bottomtoolbar.chat.toggled'); + JitsiMeetJS.analytics.sendEvent('bottomtoolbar.chat.toggled'); emitter.emit(UIEvents.TOGGLE_CHAT); } }; diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js index d0f27ae55..e83cddd13 100644 --- a/modules/UI/toolbars/Toolbar.js +++ b/modules/UI/toolbars/Toolbar.js @@ -1,7 +1,6 @@ -/* global APP, $, config, interfaceConfig */ +/* global APP, $, config, interfaceConfig, JitsiMeetJS */ /* jshint -W101 */ import UIUtil from '../util/UIUtil'; -import AnalyticsAdapter from '../../statistics/AnalyticsAdapter'; import UIEvents from '../../../service/UI/UIEvents'; let roomUrl = null; @@ -26,11 +25,11 @@ function openLinkDialog () { false, "dialog.Invite", function (e, v) { if (v && roomUrl) { - AnalyticsAdapter.sendEvent('toolbar.invite.button'); + JitsiMeetJS.analytics.sendEvent('toolbar.invite.button'); emitter.emit(UIEvents.USER_INVITED, roomUrl); } else { - AnalyticsAdapter.sendEvent('toolbar.invite.cancel'); + JitsiMeetJS.analytics.sendEvent('toolbar.invite.cancel'); } }, function (event) { @@ -44,7 +43,7 @@ function openLinkDialog () { }, function (e, v, m, f) { if(!v && !m && !f) - AnalyticsAdapter.sendEvent('toolbar.invite.close'); + JitsiMeetJS.analytics.sendEvent('toolbar.invite.close'); } ); } @@ -64,78 +63,78 @@ const buttonHandlers = { $("#unableToUnmutePopup"), true, 5000); } else { - AnalyticsAdapter.sendEvent('toolbar.audio.unmuted'); + JitsiMeetJS.analytics.sendEvent('toolbar.audio.unmuted'); emitter.emit(UIEvents.AUDIO_MUTED, false, true); } } else { - AnalyticsAdapter.sendEvent('toolbar.audio.muted'); + JitsiMeetJS.analytics.sendEvent('toolbar.audio.muted'); emitter.emit(UIEvents.AUDIO_MUTED, true, true); } }, "toolbar_button_camera": function () { if (APP.conference.videoMuted) { - AnalyticsAdapter.sendEvent('toolbar.video.enabled'); + JitsiMeetJS.analytics.sendEvent('toolbar.video.enabled'); emitter.emit(UIEvents.VIDEO_MUTED, false); } else { - AnalyticsAdapter.sendEvent('toolbar.video.disabled'); + JitsiMeetJS.analytics.sendEvent('toolbar.video.disabled'); emitter.emit(UIEvents.VIDEO_MUTED, true); } }, "toolbar_button_security": function () { - AnalyticsAdapter.sendEvent('toolbar.lock.clicked'); + JitsiMeetJS.analytics.sendEvent('toolbar.lock.clicked'); emitter.emit(UIEvents.ROOM_LOCK_CLICKED); }, "toolbar_button_link": function () { - AnalyticsAdapter.sendEvent('toolbar.invite.clicked'); + JitsiMeetJS.analytics.sendEvent('toolbar.invite.clicked'); openLinkDialog(); }, "toolbar_button_chat": function () { - AnalyticsAdapter.sendEvent('toolbar.chat.toggled'); + JitsiMeetJS.analytics.sendEvent('toolbar.chat.toggled'); emitter.emit(UIEvents.TOGGLE_CHAT); }, "toolbar_button_etherpad": function () { - AnalyticsAdapter.sendEvent('toolbar.etherpad.clicked'); + JitsiMeetJS.analytics.sendEvent('toolbar.etherpad.clicked'); emitter.emit(UIEvents.ETHERPAD_CLICKED); }, "toolbar_button_sharedvideo": function () { - AnalyticsAdapter.sendEvent('toolbar.sharedvideo.clicked'); + JitsiMeetJS.analytics.sendEvent('toolbar.sharedvideo.clicked'); emitter.emit(UIEvents.SHARED_VIDEO_CLICKED); }, "toolbar_button_desktopsharing": function () { if (APP.conference.isSharingScreen) { - AnalyticsAdapter.sendEvent('toolbar.screen.disabled'); + JitsiMeetJS.analytics.sendEvent('toolbar.screen.disabled'); } else { - AnalyticsAdapter.sendEvent('toolbar.screen.enabled'); + JitsiMeetJS.analytics.sendEvent('toolbar.screen.enabled'); } emitter.emit(UIEvents.TOGGLE_SCREENSHARING); }, "toolbar_button_fullScreen": function() { - AnalyticsAdapter.sendEvent('toolbar.fullscreen.enabled'); + JitsiMeetJS.analytics.sendEvent('toolbar.fullscreen.enabled'); UIUtil.buttonClick("#toolbar_button_fullScreen", "icon-full-screen icon-exit-full-screen"); emitter.emit(UIEvents.FULLSCREEN_TOGGLE); }, "toolbar_button_sip": function () { - AnalyticsAdapter.sendEvent('toolbar.sip.clicked'); + JitsiMeetJS.analytics.sendEvent('toolbar.sip.clicked'); showSipNumberInput(); }, "toolbar_button_dialpad": function () { - AnalyticsAdapter.sendEvent('toolbar.sip.dialpad.clicked'); + JitsiMeetJS.analytics.sendEvent('toolbar.sip.dialpad.clicked'); dialpadButtonClicked(); }, "toolbar_button_settings": function () { - AnalyticsAdapter.sendEvent('toolbar.settings.toggled'); + JitsiMeetJS.analytics.sendEvent('toolbar.settings.toggled'); emitter.emit(UIEvents.TOGGLE_SETTINGS); }, "toolbar_button_hangup": function () { - AnalyticsAdapter.sendEvent('toolbar.hangup'); + JitsiMeetJS.analytics.sendEvent('toolbar.hangup'); emitter.emit(UIEvents.HANGUP); }, "toolbar_button_login": function () { - AnalyticsAdapter.sendEvent('toolbar.authenticate.login.clicked'); + JitsiMeetJS.analytics.sendEvent('toolbar.authenticate.login.clicked'); emitter.emit(UIEvents.AUTH_CLICKED); }, "toolbar_button_logout": function () { - AnalyticsAdapter.sendEvent('toolbar.authenticate.logout.clicked'); + JitsiMeetJS.analytics.sendEvent('toolbar.authenticate.logout.clicked'); // Ask for confirmation APP.UI.messageHandler.openTwoButtonDialog( "dialog.logoutTitle", diff --git a/modules/UI/videolayout/SmallVideo.js b/modules/UI/videolayout/SmallVideo.js index dce35c271..56b6aec06 100644 --- a/modules/UI/videolayout/SmallVideo.js +++ b/modules/UI/videolayout/SmallVideo.js @@ -3,7 +3,6 @@ import Avatar from "../avatar/Avatar"; import UIUtil from "../util/UIUtil"; import UIEvents from "../../../service/UI/UIEvents"; -import AnalyticsAdapter from '../../statistics/AnalyticsAdapter'; const RTCUIHelper = JitsiMeetJS.util.RTCUIHelper; diff --git a/modules/keyboardshortcut/keyboardshortcut.js b/modules/keyboardshortcut/keyboardshortcut.js index 19ef767fe..0a2f7881b 100644 --- a/modules/keyboardshortcut/keyboardshortcut.js +++ b/modules/keyboardshortcut/keyboardshortcut.js @@ -1,5 +1,4 @@ -/* global APP, $ */ -import AnalyticsAdapter from '../statistics/AnalyticsAdapter'; +/* global APP, $, JitsiMeetJS */ //maps keycode to character, id of popover for given function and function var shortcuts = {}; function initShortcutHandlers() { @@ -14,7 +13,7 @@ function initShortcutHandlers() { character: "C", id: "toggleChatPopover", function: function() { - AnalyticsAdapter.sendEvent('shortcut.chat.toggled'); + JitsiMeetJS.analytics.sendEvent('shortcut.chat.toggled'); APP.UI.toggleChat(); } }, @@ -22,7 +21,7 @@ function initShortcutHandlers() { character: "D", id: "toggleDesktopSharingPopover", function: function () { - AnalyticsAdapter.sendEvent('shortcut.screen.toggled'); + JitsiMeetJS.analytics.sendEvent('shortcut.screen.toggled'); APP.conference.toggleScreenSharing(); } }, @@ -30,7 +29,7 @@ function initShortcutHandlers() { character: "F", id: "filmstripPopover", function: function() { - AnalyticsAdapter.sendEvent('shortcut.film.toggled'); + JitsiMeetJS.analytics.sendEvent('shortcut.film.toggled'); APP.UI.toggleFilmStrip(); } }, @@ -38,14 +37,14 @@ function initShortcutHandlers() { character: "M", id: "mutePopover", function: function() { - AnalyticsAdapter.sendEvent('shortcut.audiomute.toggled'); + JitsiMeetJS.analytics.sendEvent('shortcut.audiomute.toggled'); APP.conference.toggleAudioMuted(); } }, "R": { character: "R", function: function() { - AnalyticsAdapter.sendEvent('shortcut.raisedhand.toggled'); + JitsiMeetJS.analytics.sendEvent('shortcut.raisedhand.toggled'); APP.conference.maybeToggleRaisedHand(); } @@ -53,7 +52,7 @@ function initShortcutHandlers() { "T": { character: "T", function: function() { - AnalyticsAdapter.sendEvent('shortcut.talk.clicked'); + JitsiMeetJS.analytics.sendEvent('shortcut.talk.clicked'); APP.conference.muteAudio(true); } }, @@ -61,14 +60,14 @@ function initShortcutHandlers() { character: "V", id: "toggleVideoPopover", function: function() { - AnalyticsAdapter.sendEvent('shortcut.videomute.toggled'); + JitsiMeetJS.analytics.sendEvent('shortcut.videomute.toggled'); APP.conference.toggleVideoMuted(); } }, "?": { character: "?", function: function(e) { - AnalyticsAdapter.sendEvent('shortcut.shortcut.help'); + JitsiMeetJS.analytics.sendEvent('shortcut.shortcut.help'); APP.UI.toggleKeyboardShortcutsPanel(); } } diff --git a/modules/statistics/AnalyticsAdapter.js b/modules/statistics/AnalyticsAdapter.js deleted file mode 100644 index 29a62f018..000000000 --- a/modules/statistics/AnalyticsAdapter.js +++ /dev/null @@ -1,18 +0,0 @@ -/* global config, JitsiMeetJS */ - -// Load the integration of a third-party analytics API such as Google Analytics. -// Since we cannot guarantee the quality of the third-party service (e.g. their -// server may take noticeably long time to respond), it is in our best interest -// (in the sense that the intergration of the analytics API is important to us -// but not enough to allow it to prevent people from joining a conference) to -// download the API asynchronously. Additionally, Google Analytics will download -// its implementation asynchronously anyway so it makes sense to append the -// loading on our side rather than prepend it. -if (config.disableThirdPartyRequests !== true) { - JitsiMeetJS.util.ScriptUtil.loadScript( - 'analytics.js?v=1', - /* async */ true, - /* prepend */ false); -} - -export default JitsiMeetJS.analytics;