From 0cda79352fbce054c9fd220627132b480dfa042e Mon Sep 17 00:00:00 2001 From: Issac Gerges Date: Wed, 2 Sep 2015 12:08:04 -0500 Subject: [PATCH 1/5] Fix spelling mistake in openLinkDialog --- modules/UI/toolbars/Toolbar.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js index a0d0d1d78..eb7b4ebde 100644 --- a/modules/UI/toolbars/Toolbar.js +++ b/modules/UI/toolbars/Toolbar.js @@ -402,18 +402,18 @@ var Toolbar = (function (my) { * Opens the invite link dialog. */ my.openLinkDialog = function () { - var inviteAttreibutes; + var inviteAttributes; if (roomUrl === null) { - inviteAttreibutes = 'data-i18n="[value]roomUrlDefaultMsg" value="' + + inviteAttributes = 'data-i18n="[value]roomUrlDefaultMsg" value="' + APP.translation.translateString("roomUrlDefaultMsg") + '"'; } else { - inviteAttreibutes = "value=\"" + encodeURI(roomUrl) + "\""; + inviteAttributes = "value=\"" + encodeURI(roomUrl) + "\""; } messageHandler.openTwoButtonDialog("dialog.shareLink", null, null, '', + inviteAttributes + ' onclick="this.select();" readonly>', false, "dialog.Invite", function (e, v) { From 92a6b765a2c6b6027e63ab6405751163f409130d Mon Sep 17 00:00:00 2001 From: Issac Gerges Date: Wed, 2 Sep 2015 12:08:31 -0500 Subject: [PATCH 2/5] Add pluggable analytics framework --- analytics.js | 26 ++++++++++++++++++-------- modules/statistics/AnalyticsAdapter.js | 15 +++++++++++++++ 2 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 modules/statistics/AnalyticsAdapter.js diff --git a/analytics.js b/analytics.js index 07ea7184f..54c7ee1ae 100644 --- a/analytics.js +++ b/analytics.js @@ -1,8 +1,18 @@ -/** - * Google Analytics - */ -(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - ga('create', 'UA-319188-14', 'jit.si'); - ga('send', 'pageview'); \ No newline at end of file +(function (ctx) { + function Analytics() { + /** + * Google Analytics + */ + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + ga('create', 'UA-319188-14', 'jit.si'); + ga('send', 'pageview'); + } + + Analytics.prototype.sendEvent = function (action, data) { + ga('send', 'event', 'jit.si', action); + }; + + ctx.Analytics = Analytics; +}(window)); \ No newline at end of file diff --git a/modules/statistics/AnalyticsAdapter.js b/modules/statistics/AnalyticsAdapter.js new file mode 100644 index 000000000..8492c1123 --- /dev/null +++ b/modules/statistics/AnalyticsAdapter.js @@ -0,0 +1,15 @@ +function NoopAnalytics() {} +NoopAnalytics.prototype.sendEvent = function () {}; + +function AnalyticsAdapter() { + var AnalyticsImpl = window.Analytics || NoopAnalytics; + this.analytics = new AnalyticsImpl(); +} + +AnalyticsAdapter.prototype.sendEvent = function (action, data) { + try { + this.analytics.sendEvent.apply(this.analytics, arguments); + } catch (ignored) {} +}; + +module.exports = new AnalyticsAdapter(); \ No newline at end of file From 5734d5ad8090c26c56c53dab9720e71952fe9d51 Mon Sep 17 00:00:00 2001 From: Issac Gerges Date: Wed, 2 Sep 2015 12:08:48 -0500 Subject: [PATCH 3/5] Add analytics for toolbar items --- modules/UI/toolbars/Toolbar.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js index eb7b4ebde..31198b6f7 100644 --- a/modules/UI/toolbars/Toolbar.js +++ b/modules/UI/toolbars/Toolbar.js @@ -9,6 +9,7 @@ var Authentication = require("../authentication/Authentication"); var UIUtil = require("../util/UIUtil"); var AuthenticationEvents = require("../../../service/authentication/AuthenticationEvents"); +var AnalyticsAdapter = require("../../statistics/AnalyticsAdapter"); var roomUrl = null; var sharedKey = ''; @@ -17,55 +18,87 @@ var recordingToaster = null; var buttonHandlers = { "toolbar_button_mute": function () { + if (APP.RTC.localAudio.isMuted()) { + AnalyticsAdapter.sendEvent('toolbar.audio.unmuted') + } else { + AnalyticsAdapter.sendEvent('toolbar.audio.muted'); + } return APP.UI.toggleAudio(); }, "toolbar_button_camera": function () { + if (APP.RTC.localVideo.isMuted()) { + AnalyticsAdapter.sendEvent('toolbar.video.enabled'); + } else { + AnalyticsAdapter.sendEvent('toolbar.video.disabled'); + } return APP.UI.toggleVideo(); }, /*"toolbar_button_authentication": function () { return Toolbar.authenticateClicked(); },*/ "toolbar_button_record": function () { + AnalyticsAdapter.sendEvent('toolbar.recording.toggled'); return toggleRecording(); }, "toolbar_button_security": function () { + if (sharedKey) { + AnalyticsAdapter.sendEvent('toolbar.lock.disabled') + } else { + AnalyticsAdapter.sendEvent('toolbar.lock.enabled'); + } return Toolbar.openLockDialog(); }, "toolbar_button_link": function () { + AnalyticsAdapter.sendEvent('toolbar.invite.clicked'); return Toolbar.openLinkDialog(); }, "toolbar_button_chat": function () { + AnalyticsAdapter.sendEvent('toolbar.chat.toggled'); return BottomToolbar.toggleChat(); }, "toolbar_button_prezi": function () { + AnalyticsAdapter.sendEvent('toolbar.prezi.clicked'); return Prezi.openPreziDialog(); }, "toolbar_button_etherpad": function () { + AnalyticsAdapter.sendEvent('toolbar.etherpad.clicked'); return Etherpad.toggleEtherpad(0); }, "toolbar_button_desktopsharing": function () { + if (APP.desktopsharing.isUsingScreenStream) { + AnalyticsAdapter.sendEvent('toolbar.screen.disabled'); + } else { + AnalyticsAdapter.sendEvent('toolbar.screen.enabled'); + } return APP.desktopsharing.toggleScreenSharing(); }, "toolbar_button_fullScreen": function() { + AnalyticsAdapter.sendEvent('toolbar.fullscreen.enabled'); UIUtil.buttonClick("#toolbar_button_fullScreen", "icon-full-screen icon-exit-full-screen"); return Toolbar.toggleFullScreen(); }, "toolbar_button_sip": function () { + AnalyticsAdapter.sendEvent('toolbar.sip.clicked'); return callSipButtonClicked(); }, "toolbar_button_dialpad": function () { + AnalyticsAdapter.sendEvent('toolbar.sip.dialpad.clicked'); return dialpadButtonClicked(); }, "toolbar_button_settings": function () { + AnalyticsAdapter.sendEvent('toolbar.settings.toggled'); PanelToggler.toggleSettingsMenu(); }, "toolbar_button_hangup": function () { + AnalyticsAdapter.sendEvent('toolbar.hangup'); return hangup(); }, "toolbar_button_login": function () { + AnalyticsAdapter.sendEvent('toolbar.authenticate.login.clicked'); Toolbar.authenticateClicked(); }, "toolbar_button_logout": function () { + AnalyticsAdapter.sendEvent('toolbar.authenticate.logout.clicked'); // Ask for confirmation messageHandler.openTwoButtonDialog( "dialog.logoutTitle", From 2c573d76ea0543d878e88756035664e388ad4822 Mon Sep 17 00:00:00 2001 From: Issac Gerges Date: Wed, 2 Sep 2015 12:10:04 -0500 Subject: [PATCH 4/5] Add analytics for bottom toolbar events --- modules/UI/toolbars/BottomToolbar.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/UI/toolbars/BottomToolbar.js b/modules/UI/toolbars/BottomToolbar.js index da857ca11..5395d2825 100644 --- a/modules/UI/toolbars/BottomToolbar.js +++ b/modules/UI/toolbars/BottomToolbar.js @@ -1,14 +1,18 @@ /* global $ */ var PanelToggler = require("../side_pannels/SidePanelToggler"); +var AnalyticsAdapter = require("../../statistics/AnalyticsAdapter"); var buttonHandlers = { "bottom_toolbar_contact_list": function () { + AnalyticsAdapter.sendEvent('bottomtoolbar.contacts.toggled'); BottomToolbar.toggleContactList(); }, "bottom_toolbar_film_strip": function () { + AnalyticsAdapter.sendEvent('bottomtoolbar.filmstrip.toggled'); BottomToolbar.toggleFilmStrip(); }, "bottom_toolbar_chat": function () { + AnalyticsAdapter.sendEvent('bottomtoolbar.chat.toggled'); BottomToolbar.toggleChat(); } }; From 39c5ef2f5a4f1c2e50721c17e424805bba41cebb Mon Sep 17 00:00:00 2001 From: hristoterezov Date: Wed, 16 Sep 2015 17:44:53 -0500 Subject: [PATCH 5/5] Fixes jshint --- modules/UI/toolbars/Toolbar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/UI/toolbars/Toolbar.js b/modules/UI/toolbars/Toolbar.js index 055523bf0..824a7050c 100644 --- a/modules/UI/toolbars/Toolbar.js +++ b/modules/UI/toolbars/Toolbar.js @@ -20,7 +20,7 @@ var recordingToaster = null; var buttonHandlers = { "toolbar_button_mute": function () { if (APP.RTC.localAudio.isMuted()) { - AnalyticsAdapter.sendEvent('toolbar.audio.unmuted') + AnalyticsAdapter.sendEvent('toolbar.audio.unmuted'); } else { AnalyticsAdapter.sendEvent('toolbar.audio.muted'); } @@ -43,7 +43,7 @@ var buttonHandlers = { }, "toolbar_button_security": function () { if (sharedKey) { - AnalyticsAdapter.sendEvent('toolbar.lock.disabled') + AnalyticsAdapter.sendEvent('toolbar.lock.disabled'); } else { AnalyticsAdapter.sendEvent('toolbar.lock.enabled'); }