feat(analytics): initial Habitica-owned solution
This commit is contained in:
committed by
Kalista Payne
parent
746fcfff49
commit
e6ffd69148
@@ -3,10 +3,8 @@ import isFunction from 'lodash/isFunction';
|
||||
import min from 'lodash/min';
|
||||
import reduce from 'lodash/reduce';
|
||||
import filter from 'lodash/filter';
|
||||
import pick from 'lodash/pick';
|
||||
import pickBy from 'lodash/pickBy';
|
||||
import size from 'lodash/size';
|
||||
import moment from 'moment';
|
||||
import content from '../content/index';
|
||||
import i18n from '../i18n';
|
||||
import { daysSince } from '../cron';
|
||||
@@ -28,7 +26,7 @@ function trueRandom () {
|
||||
return Math.random();
|
||||
}
|
||||
|
||||
export default function randomDrop (user, options, req = {}, analytics) {
|
||||
export default function randomDrop (user, options, req = {}) {
|
||||
let acceptableDrops;
|
||||
let drop;
|
||||
let dropMultiplier;
|
||||
@@ -157,15 +155,5 @@ export default function randomDrop (user, options, req = {}, analytics) {
|
||||
user._tmp.drop = drop;
|
||||
user.items.lastDrop.date = Number(new Date());
|
||||
user.items.lastDrop.count += 1;
|
||||
|
||||
if (analytics && moment().diff(user.auth.timestamps.created, 'days') < 7) {
|
||||
analytics.track('dropped item', {
|
||||
user: pick(user, ['preferences', 'registeredThrough']),
|
||||
uuid: user._id,
|
||||
itemKey: drop.key,
|
||||
category: 'behavior',
|
||||
headers: req.headers,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user