Compare commits

...

2 Commits

Author SHA1 Message Date
Sabe Jones
c4be9a274c 4.183.1 2021-03-01 18:02:03 -06:00
Sabe Jones
593149abe6 fix(analytics): drop cap and Stripe platform fixes 2021-03-01 18:01:38 -06:00
4 changed files with 15 additions and 10 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{
"name": "habitica",
"version": "4.183.0",
"version": "4.183.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@@ -1,7 +1,7 @@
{
"name": "habitica",
"description": "A habit tracker app which treats your goals like a Role Playing Game.",
"version": "4.183.0",
"version": "4.183.1",
"main": "./website/server/index.js",
"dependencies": {
"@babel/core": "^7.12.10",

View File

@@ -177,15 +177,15 @@ export default function randomDrop (user, options, req = {}, analytics) {
message: i18n.t('dropCapReached', req.language),
items: dropN,
});
}
if (isEnrolledInDropCapTest) {
analytics.track('drop cap reached', {
uuid: user._id,
dropCap: maxDropCount,
category: 'behavior',
headers: req.headers,
});
if (isEnrolledInDropCapTest) {
analytics.track('drop cap reached', {
uuid: user._id,
dropCap: maxDropCount,
category: 'behavior',
headers: req.headers,
});
}
}
if (analytics && moment().diff(user.auth.timestamps.created, 'days') < 7) {

View File

@@ -251,6 +251,11 @@ function _sendDataToGoogle (eventType, data) {
function _sendPurchaseDataToAmplitude (data) {
const amplitudeData = _formatDataForAmplitude(data);
// Stripe transactions come via webhook. We can log these as Web events
if (data.paymentMethod === 'Stripe' && amplitudeData.platform === 'Unknown') {
amplitudeData.platform = 'Web';
}
amplitudeData.event_type = 'purchase';
amplitudeData.revenue = data.purchaseValue;