diff --git a/app.js b/app.js index 31b202feb1..627b577028 100644 --- a/app.js +++ b/app.js @@ -110,6 +110,11 @@ function init() { var isUIReady = APP.UI.start(); if (isUIReady) { APP.conference.init({roomName: buildRoomName()}).then(function () { + let server = APP.tokenData.server; + if(server) { + APP.conference.logEvent("server." + server, 1); + } + APP.UI.initConference(); APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) { diff --git a/conference.js b/conference.js index 7026f2d6e4..cb2919e0f8 100644 --- a/conference.js +++ b/conference.js @@ -1766,5 +1766,20 @@ export default { // Update the view APP.UI.setLocalRaisedHandStatus(raisedHand); } + }, + /** + * Log event to callstats and analytics. + * @param {string} name the event name + * @param {int} value the value (it's int because google analytics supports + * only int). + * NOTE: Should be used after conference.init + */ + logEvent(name, value) { + if(JitsiMeetJS.analytics) { + JitsiMeetJS.analytics.sendEvent(name, value); + } + if(room) { + room.sendApplicationLog(JSON.stringify({name, value})); + } } }; diff --git a/modules/TokenData/TokenData.js b/modules/TokenData/TokenData.js index 313a4850e9..9db4df5832 100644 --- a/modules/TokenData/TokenData.js +++ b/modules/TokenData/TokenData.js @@ -97,6 +97,7 @@ class TokenData{ this.payload = this.decodedJWT.payload; if(!this.payload.context) return; + this.server = this.payload.context.server; let callerData = this.payload.context.user; let calleeData = this.payload.context.callee; if(callerData)