mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Add format user data function to analytics server
This commit is contained in:
@@ -66,9 +66,26 @@ function _formatDataForAmplitude(data) {
|
||||
}
|
||||
|
||||
function _formatUserData(user) {
|
||||
var data = {};
|
||||
var properties = {};
|
||||
|
||||
return data;
|
||||
if (user.stats) {
|
||||
properties.Class = user.stats.class;
|
||||
properties.Experience = Math.floor(user.stats.exp);
|
||||
properties.Gold = Math.floor(user.stats.gp);
|
||||
properties.Health = Math.ceil(user.stats.hp);
|
||||
properties.Level = user.stats.lvl;
|
||||
properties.Mana = Math.floor(user.stats.mp);
|
||||
}
|
||||
|
||||
if (user.contributor && user.contributor.level) {
|
||||
properties.contributorLevel = user.contributor.level;
|
||||
}
|
||||
|
||||
if (user.purchased && user.purchased.plan.planId) {
|
||||
properties.subscription = user.purchased.plan.planId;
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
function _sendPurchaseDataToGoogle(data) {
|
||||
|
||||
Reference in New Issue
Block a user