瀏覽代碼

Adds some analytics events for getusermedia success or fail.

master
damencho 9 年之前
父節點
當前提交
873c5b4c93
共有 1 個檔案被更改,包括 37 行新增0 行删除
  1. 37
    0
      JitsiMeetJS.js

+ 37
- 0
JitsiMeetJS.js 查看文件

@@ -41,6 +41,29 @@ function getLowerResolution(resolution) {
41 41
     return resName;
42 42
 }
43 43
 
44
+/**
45
+ * Checks the available devices in options and concatenate the data to the
46
+ * name, which will be used as analytics event name. Adds resolution for the
47
+ * devices.
48
+ * @param name name of event
49
+ * @param options gum options
50
+ * @returns {*}
51
+ */
52
+function addDeviceTypeToAnalyticsEvent(name, options) {
53
+    if (options.devices.indexOf("audio") !== -1) {
54
+        name += ".audio";
55
+    }
56
+    if (options.devices.indexOf("desktop") !== -1) {
57
+        name += ".desktop";
58
+    }
59
+    if (options.devices.indexOf("video") !== -1) {
60
+        // we have video add resolution
61
+        name += ".video." + options.resolution;
62
+    }
63
+
64
+    return name;
65
+}
66
+
44 67
 /**
45 68
  * Namespace for the interface of Jitsi Meet Library.
46 69
  */
@@ -176,6 +199,9 @@ var LibJitsiMeet = {
176 199
                 window.connectionTimes["obtainPermissions.end"] =
177 200
                     window.performance.now();
178 201
 
202
+                Statistics.analytics.sendEvent(addDeviceTypeToAnalyticsEvent(
203
+                    "getUserMedia.success", options), options);
204
+
179 205
                 if(!RTC.options.disableAudioLevels)
180 206
                     for(var i = 0; i < tracks.length; i++) {
181 207
                         var track = tracks[i];
@@ -205,6 +231,9 @@ var LibJitsiMeet = {
205 231
                         logger.debug("Retry createLocalTracks with resolution",
206 232
                             newResolution);
207 233
 
234
+                        Statistics.analytics.sendEvent(
235
+                            "getUserMedia.fail.resolution." + oldResolution);
236
+
208 237
                         return LibJitsiMeet.createLocalTracks(options);
209 238
                     }
210 239
                 }
@@ -219,6 +248,8 @@ var LibJitsiMeet = {
219 248
                         message: error.message
220 249
                     };
221 250
                     Statistics.sendLog(JSON.stringify(logObject));
251
+                    Statistics.analytics.sendEvent(
252
+                        "getUserMedia.userCancel.extensionInstall");
222 253
                 } else {
223 254
                     // Report gUM failed to the stats
224 255
                     Statistics.sendGetUserMediaFailed(error);
@@ -227,6 +258,12 @@ var LibJitsiMeet = {
227 258
                 window.connectionTimes["obtainPermissions.end"] =
228 259
                     window.performance.now();
229 260
 
261
+
262
+                Statistics.analytics.sendEvent(
263
+                    addDeviceTypeToAnalyticsEvent(
264
+                        "getUserMedia.failed", options) + '.' + error.name,
265
+                    options);
266
+
230 267
                 return Promise.reject(error);
231 268
             }.bind(this));
232 269
     },

Loading…
取消
儲存