Merge branch 'analytics'
This commit is contained in:
commit
1f66abac4d
12
analytics.js
12
analytics.js
|
@ -16,17 +16,15 @@
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
}
|
}
|
||||||
|
|
||||||
Analytics.prototype.sendEvent = function (action, data, label, browserName) {
|
Analytics.prototype.sendEvent = function (action, data) {
|
||||||
// empty label if missing value for it and add the value,
|
// empty label if missing value for it and add the value,
|
||||||
// the value should be integer or null
|
// the value should be integer or null
|
||||||
var value = Math.round(parseFloat(data));
|
var value = data.value;
|
||||||
|
value = value? Math.round(parseFloat(value)) : null;
|
||||||
|
var label = data.label || "";
|
||||||
|
|
||||||
ga('send', 'event', 'jit.si',
|
ga('send', 'event', 'jit.si',
|
||||||
action + '.' + browserName, label ? label : "", value ? value : null);
|
action + '.' + data.browserName, label, value);
|
||||||
};
|
|
||||||
|
|
||||||
Analytics.prototype.sendFeedback = function (data, label, browserName) {
|
|
||||||
this.sendEvent('feedback.rating', data.overall, label, browserName);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ctx.Analytics = Analytics;
|
ctx.Analytics = Analytics;
|
||||||
|
|
5
app.js
5
app.js
|
@ -110,11 +110,6 @@ function init() {
|
||||||
var isUIReady = APP.UI.start();
|
var isUIReady = APP.UI.start();
|
||||||
if (isUIReady) {
|
if (isUIReady) {
|
||||||
APP.conference.init({roomName: buildRoomName()}).then(function () {
|
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.initConference();
|
||||||
|
|
||||||
APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {
|
APP.UI.addListener(UIEvents.LANG_CHANGED, function (language) {
|
||||||
|
|
|
@ -485,6 +485,39 @@ class ConferenceConnector {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends statistics from APP.tokenData
|
||||||
|
*/
|
||||||
|
function sendTokenDataStats() {
|
||||||
|
let {server, group} = APP.tokenData;
|
||||||
|
if(server) {
|
||||||
|
APP.conference.logEvent("server." + server, 1);
|
||||||
|
}
|
||||||
|
if(group) {
|
||||||
|
APP.conference.logEvent("group", group);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set permanent ptoperties to analytics.
|
||||||
|
* NOTE: Has to be used after JitsiMeetJS.init. otherwise analytics will be
|
||||||
|
* null.
|
||||||
|
*/
|
||||||
|
function setAnalyticsPermanentProperties() {
|
||||||
|
let permanentProperties = {
|
||||||
|
userAgent: navigator.userAgent,
|
||||||
|
roomName: APP.conference.roomName
|
||||||
|
};
|
||||||
|
let {server, group} = APP.tokenData;
|
||||||
|
if(server) {
|
||||||
|
permanentProperties.server = server;
|
||||||
|
}
|
||||||
|
if(group) {
|
||||||
|
permanentProperties.group = group;
|
||||||
|
}
|
||||||
|
JitsiMeetJS.analytics.addPermanentProperties(permanentProperties);
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
isModerator: false,
|
isModerator: false,
|
||||||
audioMuted: false,
|
audioMuted: false,
|
||||||
|
@ -532,8 +565,11 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
return JitsiMeetJS.init(config)
|
return JitsiMeetJS.init(config)
|
||||||
.then(() => createInitialLocalTracksAndConnect(options.roomName))
|
.then(() => {
|
||||||
.then(([tracks, con]) => {
|
setAnalyticsPermanentProperties();
|
||||||
|
sendTokenDataStats();
|
||||||
|
return createInitialLocalTracksAndConnect(options.roomName);
|
||||||
|
}).then(([tracks, con]) => {
|
||||||
console.log('initialized with %s local tracks', tracks.length);
|
console.log('initialized with %s local tracks', tracks.length);
|
||||||
APP.connection = connection = con;
|
APP.connection = connection = con;
|
||||||
this._createRoom(tracks);
|
this._createRoom(tracks);
|
||||||
|
@ -1452,7 +1488,8 @@ export default {
|
||||||
// Longer delays will be caused by something else and will just
|
// Longer delays will be caused by something else and will just
|
||||||
// poison the data.
|
// poison the data.
|
||||||
if (delay < 2000) {
|
if (delay < 2000) {
|
||||||
JitsiMeetJS.analytics.sendEvent('stream.switch.delay', delay);
|
JitsiMeetJS.analytics.sendEvent('stream.switch.delay',
|
||||||
|
{value: delay});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1764,7 +1801,7 @@ export default {
|
||||||
*/
|
*/
|
||||||
logEvent(name, value) {
|
logEvent(name, value) {
|
||||||
if(JitsiMeetJS.analytics) {
|
if(JitsiMeetJS.analytics) {
|
||||||
JitsiMeetJS.analytics.sendEvent(name, value);
|
JitsiMeetJS.analytics.sendEvent(name, {value});
|
||||||
}
|
}
|
||||||
if(room) {
|
if(room) {
|
||||||
room.sendApplicationLog(JSON.stringify({name, value}));
|
room.sendApplicationLog(JSON.stringify({name, value}));
|
||||||
|
|
|
@ -99,6 +99,7 @@ class TokenData{
|
||||||
if(!this.payload.context)
|
if(!this.payload.context)
|
||||||
return;
|
return;
|
||||||
this.server = this.payload.context.server;
|
this.server = this.payload.context.server;
|
||||||
|
this.group = this.payload.context.group;
|
||||||
let callerData = this.payload.context.user;
|
let callerData = this.payload.context.user;
|
||||||
let calleeData = this.payload.context.callee;
|
let calleeData = this.payload.context.callee;
|
||||||
if(callerData)
|
if(callerData)
|
||||||
|
|
Loading…
Reference in New Issue