Browse Source

Adds optional label to statistics implementation.

j8
damencho 8 years ago
parent
commit
35f592bb2c
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      analytics.js

+ 5
- 3
analytics.js View File

@@ -10,11 +10,13 @@
10 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 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 22
   ctx.Analytics = Analytics;

Loading…
Cancel
Save