Merge branch 'analytics'
This commit is contained in:
commit
1f66abac4d
12
analytics.js
12
analytics.js
|
@ -16,17 +16,15 @@
|
|||
/* 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,
|
||||
// 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',
|
||||
action + '.' + browserName, label ? label : "", value ? value : null);
|
||||
};
|
||||
|
||||
Analytics.prototype.sendFeedback = function (data, label, browserName) {
|
||||
this.sendEvent('feedback.rating', data.overall, label, browserName);
|
||||
action + '.' + data.browserName, label, value);
|
||||
};
|
||||
|
||||
ctx.Analytics = Analytics;
|
||||
|
|
5
app.js
5
app.js
|
@ -110,11 +110,6 @@ 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) {
|
||||
|
|
|
@ -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 {
|
||||
isModerator: false,
|
||||
audioMuted: false,
|
||||
|
@ -532,8 +565,11 @@ export default {
|
|||
}
|
||||
|
||||
return JitsiMeetJS.init(config)
|
||||
.then(() => createInitialLocalTracksAndConnect(options.roomName))
|
||||
.then(([tracks, con]) => {
|
||||
.then(() => {
|
||||
setAnalyticsPermanentProperties();
|
||||
sendTokenDataStats();
|
||||
return createInitialLocalTracksAndConnect(options.roomName);
|
||||
}).then(([tracks, con]) => {
|
||||
console.log('initialized with %s local tracks', tracks.length);
|
||||
APP.connection = connection = con;
|
||||
this._createRoom(tracks);
|
||||
|
@ -1452,7 +1488,8 @@ export default {
|
|||
// Longer delays will be caused by something else and will just
|
||||
// poison the data.
|
||||
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) {
|
||||
if(JitsiMeetJS.analytics) {
|
||||
JitsiMeetJS.analytics.sendEvent(name, value);
|
||||
JitsiMeetJS.analytics.sendEvent(name, {value});
|
||||
}
|
||||
if(room) {
|
||||
room.sendApplicationLog(JSON.stringify({name, value}));
|
||||
|
|
|
@ -99,6 +99,7 @@ class TokenData{
|
|||
if(!this.payload.context)
|
||||
return;
|
||||
this.server = this.payload.context.server;
|
||||
this.group = this.payload.context.group;
|
||||
let callerData = this.payload.context.user;
|
||||
let calleeData = this.payload.context.callee;
|
||||
if(callerData)
|
||||
|
|
Loading…
Reference in New Issue