Merge branch 'gerges-issue/client-analytics'
This commit is contained in:
commit
a7cd8bab11
26
analytics.js
26
analytics.js
|
@ -1,8 +1,18 @@
|
||||||
/**
|
(function (ctx) {
|
||||||
* Google Analytics
|
function Analytics() {
|
||||||
*/
|
/**
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
* Google Analytics
|
||||||
(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');
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
ga('create', 'UA-319188-14', 'jit.si');
|
(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)
|
||||||
ga('send', 'pageview');
|
})(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));
|
|
@ -1,15 +1,19 @@
|
||||||
/* global $ */
|
/* global $ */
|
||||||
var PanelToggler = require("../side_pannels/SidePanelToggler");
|
var PanelToggler = require("../side_pannels/SidePanelToggler");
|
||||||
var UIUtil = require("../util/UIUtil");
|
var UIUtil = require("../util/UIUtil");
|
||||||
|
var AnalyticsAdapter = require("../../statistics/AnalyticsAdapter");
|
||||||
|
|
||||||
var buttonHandlers = {
|
var buttonHandlers = {
|
||||||
"bottom_toolbar_contact_list": function () {
|
"bottom_toolbar_contact_list": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('bottomtoolbar.contacts.toggled');
|
||||||
BottomToolbar.toggleContactList();
|
BottomToolbar.toggleContactList();
|
||||||
},
|
},
|
||||||
"bottom_toolbar_film_strip": function () {
|
"bottom_toolbar_film_strip": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('bottomtoolbar.filmstrip.toggled');
|
||||||
BottomToolbar.toggleFilmStrip();
|
BottomToolbar.toggleFilmStrip();
|
||||||
},
|
},
|
||||||
"bottom_toolbar_chat": function () {
|
"bottom_toolbar_chat": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('bottomtoolbar.chat.toggled');
|
||||||
BottomToolbar.toggleChat();
|
BottomToolbar.toggleChat();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,6 +10,7 @@ var Authentication = require("../authentication/Authentication");
|
||||||
var UIUtil = require("../util/UIUtil");
|
var UIUtil = require("../util/UIUtil");
|
||||||
var AuthenticationEvents
|
var AuthenticationEvents
|
||||||
= require("../../../service/authentication/AuthenticationEvents");
|
= require("../../../service/authentication/AuthenticationEvents");
|
||||||
|
var AnalyticsAdapter = require("../../statistics/AnalyticsAdapter");
|
||||||
|
|
||||||
var roomUrl = null;
|
var roomUrl = null;
|
||||||
var sharedKey = '';
|
var sharedKey = '';
|
||||||
|
@ -18,55 +19,87 @@ var recordingToaster = null;
|
||||||
|
|
||||||
var buttonHandlers = {
|
var buttonHandlers = {
|
||||||
"toolbar_button_mute": function () {
|
"toolbar_button_mute": function () {
|
||||||
|
if (APP.RTC.localAudio.isMuted()) {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.audio.unmuted');
|
||||||
|
} else {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.audio.muted');
|
||||||
|
}
|
||||||
return APP.UI.toggleAudio();
|
return APP.UI.toggleAudio();
|
||||||
},
|
},
|
||||||
"toolbar_button_camera": function () {
|
"toolbar_button_camera": function () {
|
||||||
|
if (APP.RTC.localVideo.isMuted()) {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.video.enabled');
|
||||||
|
} else {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.video.disabled');
|
||||||
|
}
|
||||||
return APP.UI.toggleVideo();
|
return APP.UI.toggleVideo();
|
||||||
},
|
},
|
||||||
/*"toolbar_button_authentication": function () {
|
/*"toolbar_button_authentication": function () {
|
||||||
return Toolbar.authenticateClicked();
|
return Toolbar.authenticateClicked();
|
||||||
},*/
|
},*/
|
||||||
"toolbar_button_record": function () {
|
"toolbar_button_record": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.recording.toggled');
|
||||||
return toggleRecording();
|
return toggleRecording();
|
||||||
},
|
},
|
||||||
"toolbar_button_security": function () {
|
"toolbar_button_security": function () {
|
||||||
|
if (sharedKey) {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.lock.disabled');
|
||||||
|
} else {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.lock.enabled');
|
||||||
|
}
|
||||||
return Toolbar.openLockDialog();
|
return Toolbar.openLockDialog();
|
||||||
},
|
},
|
||||||
"toolbar_button_link": function () {
|
"toolbar_button_link": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.invite.clicked');
|
||||||
return Toolbar.openLinkDialog();
|
return Toolbar.openLinkDialog();
|
||||||
},
|
},
|
||||||
"toolbar_button_chat": function () {
|
"toolbar_button_chat": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.chat.toggled');
|
||||||
return BottomToolbar.toggleChat();
|
return BottomToolbar.toggleChat();
|
||||||
},
|
},
|
||||||
"toolbar_button_prezi": function () {
|
"toolbar_button_prezi": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.prezi.clicked');
|
||||||
return Prezi.openPreziDialog();
|
return Prezi.openPreziDialog();
|
||||||
},
|
},
|
||||||
"toolbar_button_etherpad": function () {
|
"toolbar_button_etherpad": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.etherpad.clicked');
|
||||||
return Etherpad.toggleEtherpad(0);
|
return Etherpad.toggleEtherpad(0);
|
||||||
},
|
},
|
||||||
"toolbar_button_desktopsharing": function () {
|
"toolbar_button_desktopsharing": function () {
|
||||||
|
if (APP.desktopsharing.isUsingScreenStream) {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.screen.disabled');
|
||||||
|
} else {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.screen.enabled');
|
||||||
|
}
|
||||||
return APP.desktopsharing.toggleScreenSharing();
|
return APP.desktopsharing.toggleScreenSharing();
|
||||||
},
|
},
|
||||||
"toolbar_button_fullScreen": function() {
|
"toolbar_button_fullScreen": function() {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.fullscreen.enabled');
|
||||||
UIUtil.buttonClick("#toolbar_button_fullScreen", "icon-full-screen icon-exit-full-screen");
|
UIUtil.buttonClick("#toolbar_button_fullScreen", "icon-full-screen icon-exit-full-screen");
|
||||||
return Toolbar.toggleFullScreen();
|
return Toolbar.toggleFullScreen();
|
||||||
},
|
},
|
||||||
"toolbar_button_sip": function () {
|
"toolbar_button_sip": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.sip.clicked');
|
||||||
return callSipButtonClicked();
|
return callSipButtonClicked();
|
||||||
},
|
},
|
||||||
"toolbar_button_dialpad": function () {
|
"toolbar_button_dialpad": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.sip.dialpad.clicked');
|
||||||
return dialpadButtonClicked();
|
return dialpadButtonClicked();
|
||||||
},
|
},
|
||||||
"toolbar_button_settings": function () {
|
"toolbar_button_settings": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.settings.toggled');
|
||||||
PanelToggler.toggleSettingsMenu();
|
PanelToggler.toggleSettingsMenu();
|
||||||
},
|
},
|
||||||
"toolbar_button_hangup": function () {
|
"toolbar_button_hangup": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.hangup');
|
||||||
return hangup();
|
return hangup();
|
||||||
},
|
},
|
||||||
"toolbar_button_login": function () {
|
"toolbar_button_login": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.authenticate.login.clicked');
|
||||||
Toolbar.authenticateClicked();
|
Toolbar.authenticateClicked();
|
||||||
},
|
},
|
||||||
"toolbar_button_logout": function () {
|
"toolbar_button_logout": function () {
|
||||||
|
AnalyticsAdapter.sendEvent('toolbar.authenticate.logout.clicked');
|
||||||
// Ask for confirmation
|
// Ask for confirmation
|
||||||
messageHandler.openTwoButtonDialog(
|
messageHandler.openTwoButtonDialog(
|
||||||
"dialog.logoutTitle",
|
"dialog.logoutTitle",
|
||||||
|
@ -418,18 +451,18 @@ var Toolbar = (function (my) {
|
||||||
* Opens the invite link dialog.
|
* Opens the invite link dialog.
|
||||||
*/
|
*/
|
||||||
my.openLinkDialog = function () {
|
my.openLinkDialog = function () {
|
||||||
var inviteAttreibutes;
|
var inviteAttributes;
|
||||||
|
|
||||||
if (roomUrl === null) {
|
if (roomUrl === null) {
|
||||||
inviteAttreibutes = 'data-i18n="[value]roomUrlDefaultMsg" value="' +
|
inviteAttributes = 'data-i18n="[value]roomUrlDefaultMsg" value="' +
|
||||||
APP.translation.translateString("roomUrlDefaultMsg") + '"';
|
APP.translation.translateString("roomUrlDefaultMsg") + '"';
|
||||||
} else {
|
} else {
|
||||||
inviteAttreibutes = "value=\"" + encodeURI(roomUrl) + "\"";
|
inviteAttributes = "value=\"" + encodeURI(roomUrl) + "\"";
|
||||||
}
|
}
|
||||||
messageHandler.openTwoButtonDialog("dialog.shareLink",
|
messageHandler.openTwoButtonDialog("dialog.shareLink",
|
||||||
null, null,
|
null, null,
|
||||||
'<input id="inviteLinkRef" type="text" ' +
|
'<input id="inviteLinkRef" type="text" ' +
|
||||||
inviteAttreibutes + ' onclick="this.select();" readonly>',
|
inviteAttributes + ' onclick="this.select();" readonly>',
|
||||||
false,
|
false,
|
||||||
"dialog.Invite",
|
"dialog.Invite",
|
||||||
function (e, v) {
|
function (e, v) {
|
||||||
|
|
|
@ -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();
|
Loading…
Reference in New Issue