allowing Analytics.increment to have a callback

v1.18.x
Julian Lam 8 years ago
parent ebc9abd773
commit 9ada35cfb9

@ -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) {

Loading…
Cancel
Save