浏览代码

Adds optional label to statistics implementation.

master
damencho 9 年前
父节点
当前提交
35f592bb2c
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5
    3
      analytics.js

+ 5
- 3
analytics.js 查看文件

10
     ga('send', 'pageview');
10
     ga('send', 'pageview');
11
   }
11
   }
12
 
12
 
13
-  Analytics.prototype.sendEvent = function (action, data) {
14
-    // empty label and add the value, the value should be integer or null
13
+  Analytics.prototype.sendEvent = function (action, data, label) {
14
+    // empty label if missing value for it and add the value,
15
+    // the value should be integer or null
15
     var value = Math.round(parseFloat(data));
16
     var value = Math.round(parseFloat(data));
16
 
17
 
17
-    ga('send', 'event', 'jit.si', action, "", value ? value : null);
18
+    ga('send', 'event', 'jit.si',
19
+        action, label ? label : "", value ? value : null);
18
   };
20
   };
19
 
21
 
20
   ctx.Analytics = Analytics;
22
   ctx.Analytics = Analytics;

正在加载...
取消
保存