浏览代码

Adds optional label to analytics handler.

dev1
damencho 9 年前
父节点
当前提交
a94fab12f1
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 2
    1
      JitsiConnection.js
  2. 6
    4
      modules/statistics/AnalyticsAdapter.js

+ 2
- 1
JitsiConnection.js 查看文件

@@ -21,7 +21,8 @@ function JitsiConnection(appID, token, options) {
21 21
 
22 22
     this.addEventListener(JitsiConnectionEvents.CONNECTION_FAILED,
23 23
         function (errType, msg) {
24
-            Statistics.analytics.sendEvent('connection.failed.' + errType);
24
+            // sends analytics and callstats event
25
+            Statistics.sendEventToAll('connection.failed.' + errType, msg);
25 26
         }.bind(this));
26 27
 
27 28
     this.addEventListener(JitsiConnectionEvents.CONNECTION_DISCONNECTED,

+ 6
- 4
modules/statistics/AnalyticsAdapter.js 查看文件

@@ -17,7 +17,7 @@ AnalyticsAdapter.eventsQueue = [];
17 17
 // implementation we will use here and we have to postpone it i.e. we will make
18 18
 // a lazy decision, will wait for loaded or dispose methods to be called.
19 19
 // in the meantime we accumulate any events received
20
-AnalyticsAdapter.prototype.sendEvent = function (action, data) {
20
+AnalyticsAdapter.prototype.sendEvent = function (action, data, label) {
21 21
     if (this.analytics === null || typeof this.analytics === 'undefined') {
22 22
         // missing this.analytics but have window implementation, let's use it
23 23
         if (window.Analytics) {
@@ -26,14 +26,16 @@ AnalyticsAdapter.prototype.sendEvent = function (action, data) {
26 26
         else {
27 27
             AnalyticsAdapter.eventsQueue.push({
28 28
                 action: action,
29
-                data: data
29
+                data: data,
30
+                label: label
30 31
             });
31 32
             // stored, lets break here
32 33
             return;
33 34
         }
34 35
     }
35 36
     try {
36
-        this.analytics.sendEvent(action + this.browserActionSuffix, data);
37
+        this.analytics.sendEvent(
38
+            action + this.browserActionSuffix, data, label);
37 39
     } catch (ignored) {}
38 40
 };
39 41
 
@@ -57,7 +59,7 @@ AnalyticsAdapter.prototype.loaded = function () {
57 59
     // new analytics lets send all events if any
58 60
     if (AnalyticsAdapter.eventsQueue.length) {
59 61
         AnalyticsAdapter.eventsQueue.forEach(function (event) {
60
-            this.sendEvent(event.action, event.data);
62
+            this.sendEvent(event.action, event.data. event.label);
61 63
         }.bind(this));
62 64
         AnalyticsAdapter.eventsQueue.length = 0;
63 65
     }

正在加载...
取消
保存