Bläddra i källkod

Adds option to send email as identifier in stats.

dev1
damencho 6 år sedan
förälder
incheckning
fe988ae391
4 ändrade filer med 13 tillägg och 20 borttagningar
  1. 7
    1
      JitsiConference.js
  2. 1
    0
      doc/API.md
  3. 3
    14
      modules/statistics/AnalyticsAdapter.js
  4. 2
    5
      modules/statistics/statistics.js

+ 7
- 1
JitsiConference.js Visa fil

@@ -285,7 +285,8 @@ JitsiConference.prototype._init = function(options = {}) {
285 285
     }
286 286
 
287 287
     const { config } = this.options;
288
-    const statsCurrentId = Settings.callStatsUserName;
288
+    const statsCurrentId = config.enableEmailInStats && config.email
289
+        ? config.email : Settings.callStatsUserName;
289 290
 
290 291
     if (config.enableStatsID) {
291 292
         config.statsId = statsCurrentId;
@@ -378,6 +379,11 @@ JitsiConference.prototype._init = function(options = {}) {
378 379
             applicationName: config.applicationName,
379 380
             getWiFiStatsMethod: config.getWiFiStatsMethod
380 381
         });
382
+        Statistics.analytics.addPermanentProperties({
383
+            'callstats_name': aliasName,
384
+            'user_agent': navigator.userAgent,
385
+            'browser_name': browser.getName()
386
+        });
381 387
     }
382 388
 
383 389
     this.eventManager.setupChatRoomListeners();

+ 1
- 0
doc/API.md Visa fil

@@ -229,6 +229,7 @@ This objects represents the server connection. You can create new ```JitsiConnec
229 229
         9. enableDisplayNameInStats - enables sending the users display name, if set, to callstats as alias of the endpointID stats
230 230
         10. startSilent - enables silent mode, will mark audio as inactive will not send/receive audio
231 231
         11. confID - Used for statistics to identify conference, if tenants are supported will contain tenant and the non lower case variant for the room name.
232
+        12. enableEmailInStats - enables sending the users emails to callstats as id of the endpointID stats, set as presence so it can reach jicofo and jvb to use it when reporting, set as id to the anlytics
232 233
 
233 234
         **NOTE: if 4 and 5 are set the library is going to send events to callstats. Otherwise the callstats integration will be disabled.**
234 235
 

+ 3
- 14
modules/statistics/AnalyticsAdapter.js Visa fil

@@ -5,7 +5,6 @@ import {
5 5
     TYPE_UI
6 6
 } from '../../service/statistics/AnalyticsEvents';
7 7
 import { getLogger } from 'jitsi-meet-logger';
8
-import browser from '../browser';
9 8
 
10 9
 const MAX_CACHE_SIZE = 100;
11 10
 
@@ -54,15 +53,9 @@ const logger = getLogger(__filename);
54 53
  * action, actionSubject, source, containerType, containerId, objectType,
55 54
  * objectId
56 55
  */
57
-export default class AnalyticsAdapter {
58
-    /**
59
-     * The options to configure Statistics.
60
-     * @typedef {Object} AnalyticsOptions
61
-     * @property {string} statsId - The id that will be used to be passed with all analytics for current session.
62
-     */
56
+class AnalyticsAdapter {
63 57
     /**
64 58
      * Creates new AnalyticsAdapter instance.
65
-     * @param {AnalyticsOptions} options - The options to use creating the AnalyticsAdapter.
66 59
      */
67 60
     constructor(options) {
68 61
         this.options = options;
@@ -108,12 +101,6 @@ export default class AnalyticsAdapter {
108 101
          * @type {null}
109 102
          */
110 103
         this.conferenceName = '';
111
-
112
-        this.addPermanentProperties({
113
-            'callstats_name': this.options.statsId,
114
-            'user_agent': navigator.userAgent,
115
-            'browser_name': browser.getName()
116
-        });
117 104
     }
118 105
 
119 106
     /**
@@ -357,3 +344,5 @@ export default class AnalyticsAdapter {
357 344
         }
358 345
     }
359 346
 }
347
+
348
+export default new AnalyticsAdapter();

+ 2
- 5
modules/statistics/statistics.js Visa fil

@@ -1,7 +1,7 @@
1 1
 import EventEmitter from 'events';
2 2
 
3 3
 import { FEEDBACK } from '../../service/statistics/AnalyticsEvents';
4
-import Analytics from './AnalyticsAdapter';
4
+import analytics from './AnalyticsAdapter';
5 5
 import CallStats from './CallStats';
6 6
 import LocalStats from './LocalStatsCollector';
7 7
 import RTPStats from './RTPStatsCollector';
@@ -151,10 +151,6 @@ export default function Statistics(xmpp, options) {
151 151
     this.xmpp = xmpp;
152 152
     this.options = options || {};
153 153
 
154
-    Statistics.analytics = new Analytics({
155
-        statsId: this.options.aliasName
156
-    });
157
-
158 154
     this.callStatsIntegrationEnabled
159 155
         = this.options.callStatsID && this.options.callStatsSecret
160 156
 
@@ -191,6 +187,7 @@ export default function Statistics(xmpp, options) {
191 187
 Statistics.audioLevelsEnabled = false;
192 188
 Statistics.audioLevelsInterval = 200;
193 189
 Statistics.disableThirdPartyRequests = false;
190
+Statistics.analytics = analytics;
194 191
 
195 192
 Object.defineProperty(Statistics, 'instances', {
196 193
     /**

Laddar…
Avbryt
Spara