diff --git a/src/analytics.js b/src/analytics.js index 6b248057da..9151bd6ce7 100644 --- a/src/analytics.js +++ b/src/analytics.js @@ -20,13 +20,17 @@ new cronJob('*/10 * * * *', function () { Analytics.writeData(); }, null, true); -Analytics.increment = function (keys) { +Analytics.increment = function (keys, callback) { keys = Array.isArray(keys) ? keys : [keys]; keys.forEach(function (key) { counters[key] = counters[key] || 0; ++counters[key]; }); + + if (typeof callback === 'function') { + callback(); + } }; Analytics.pageView = function (payload) {