mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
chore(analytics): open the task firehose
This commit is contained in:
@@ -199,8 +199,7 @@ api.createUserTasks = {
|
||||
res.respond(201, tasks.length === 1 ? tasks[0] : tasks);
|
||||
|
||||
tasks.forEach(task => {
|
||||
// Track when new users (first 7 days) create tasks
|
||||
if (moment().diff(user.auth.timestamps.created, 'days') < 7 && user.flags.welcomed) {
|
||||
if (user.flags.welcomed) { // Don't send Habitica default tasks to analytics
|
||||
res.analytics.track('task create', {
|
||||
uuid: user._id,
|
||||
hitType: 'event',
|
||||
|
||||
@@ -438,17 +438,14 @@ async function scoreTask (user, task, direction, req, res) {
|
||||
user,
|
||||
});
|
||||
|
||||
// Track when new users (first 7 days) score tasks
|
||||
if (moment().diff(user.auth.timestamps.created, 'days') < 3) {
|
||||
res.analytics.track('task score', {
|
||||
uuid: user._id,
|
||||
hitType: 'event',
|
||||
category: 'behavior',
|
||||
taskType: task.type,
|
||||
direction,
|
||||
headers: req.headers,
|
||||
});
|
||||
}
|
||||
res.analytics.track('task score', {
|
||||
uuid: user._id,
|
||||
hitType: 'event',
|
||||
category: 'behavior',
|
||||
taskType: task.type,
|
||||
direction,
|
||||
headers: req.headers,
|
||||
});
|
||||
|
||||
return {
|
||||
task,
|
||||
|
||||
Reference in New Issue
Block a user