feat(analytics): add reason as label to page reload event

This commit is contained in:
paweldomas 2016-11-28 15:45:09 -06:00
parent 8745efb81f
commit df721cbd2e
3 changed files with 18 additions and 9 deletions

View File

@ -387,7 +387,7 @@ class ConferenceConnector {
// the app. Both the errors above are unrecoverable from the library
// perspective.
room.leave().then(() => connection.disconnect());
APP.UI.showPageReloadOverlay();
APP.UI.showPageReloadOverlay(err);
break;
case ConferenceErrors.CONFERENCE_MAX_USERS:
@ -550,7 +550,8 @@ export default {
// - connection dropped(closed by Strophe unexpectedly
// possible due too many transport errors)
logger.error("XMPP connection error: " + errMsg);
APP.UI.showPageReloadOverlay();
APP.UI.showPageReloadOverlay(
"xmpp-conn-dropped:" + errMsg);
connection.removeEventListener(
ConnectionEvents.CONNECTION_FAILED, handler);
// FIXME it feels like the conference should be stopped
@ -1736,14 +1737,16 @@ export default {
* @param {string} name the event name
* @param {int} value the value (it's int because google analytics supports
* only int).
* @param {string} label short text which provides more info about the event
* which allows to distinguish between few event cases of the same name
* NOTE: Should be used after conference.init
*/
logEvent(name, value) {
logEvent(name, value, label) {
if(JitsiMeetJS.analytics) {
JitsiMeetJS.analytics.sendEvent(name, {value});
JitsiMeetJS.analytics.sendEvent(name, {value, label});
}
if(room) {
room.sendApplicationLog(JSON.stringify({name, value}));
room.sendApplicationLog(JSON.stringify({name, value, label}));
}
},
/**

View File

@ -1092,10 +1092,13 @@ UI.notifyFocusDisconnected = function (focus, retrySec) {
/**
* Notify the user that the video conferencing service is badly broken and
* the page should be reloaded.
*
* @param {string} a label string identifying the reason for the page reload
* which will be included in details of the log event.
*/
UI.showPageReloadOverlay = function () {
UI.showPageReloadOverlay = function (reason) {
// Reload the page after 10 - 30 seconds
PageReloadOverlay.show(10 + RandomUtil.randomInt(0, 20));
PageReloadOverlay.show(10 + RandomUtil.randomInt(0, 20), reason);
};
/**

View File

@ -113,8 +113,10 @@ export default {
*
* @param {number} timeoutSeconds how many seconds before the conference
* reload will happen.
* @param {string} reason a label string identifying the reason for the page
* reload which will be included in details of the log event
*/
show(timeoutSeconds) {
show(timeoutSeconds, reason) {
if (!overlay) {
overlay = new PageReloadOverlayImpl(timeoutSeconds);
@ -124,7 +126,8 @@ export default {
// FIXME (CallStats - issue) this event will not make it to
// the CallStats, because the log queue is not flushed, before
// "fabric terminated" is sent to the backed
APP.conference.logEvent('page.reload');
APP.conference.logEvent(
'page.reload', undefined /* value */, reason /* label */);
}
overlay.show();
}