From 35f592bb2c7f6ff61e4e9b234b0f2f19e0187d07 Mon Sep 17 00:00:00 2001 From: damencho Date: Mon, 22 Aug 2016 15:18:13 -0500 Subject: [PATCH] Adds optional label to statistics implementation. --- analytics.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/analytics.js b/analytics.js index 7dc8aed91..fb3e62de9 100644 --- a/analytics.js +++ b/analytics.js @@ -10,11 +10,13 @@ ga('send', 'pageview'); } - Analytics.prototype.sendEvent = function (action, data) { - // empty label and add the value, the value should be integer or null + Analytics.prototype.sendEvent = function (action, data, label) { + // empty label if missing value for it and add the value, + // the value should be integer or null var value = Math.round(parseFloat(data)); - ga('send', 'event', 'jit.si', action, "", value ? value : null); + ga('send', 'event', 'jit.si', + action, label ? label : "", value ? value : null); }; ctx.Analytics = Analytics;