mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-13 15:38:59 +00:00
chore(analytics): track first-time-purchase info
This commit is contained in:
parent
7cac574c31
commit
708bd4a292
2 changed files with 4 additions and 2 deletions
|
|
@ -108,6 +108,7 @@ export async function buyGems (data) {
|
||||||
gift: Boolean(data.gift),
|
gift: Boolean(data.gift),
|
||||||
purchaseValue: amt,
|
purchaseValue: amt,
|
||||||
headers: data.headers,
|
headers: data.headers,
|
||||||
|
firstPurchase: data.user.purchased.txnCount === 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data.gift) await buyGemGift(data);
|
if (data.gift) await buyGemGift(data);
|
||||||
|
|
|
||||||
|
|
@ -172,6 +172,8 @@ async function createSubscription (data) {
|
||||||
txnEmail(data.user, emailType);
|
txnEmail(data.user, emailType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!group && !data.promo) data.user.purchased.txnCount += 1;
|
||||||
|
|
||||||
if (!data.promo) {
|
if (!data.promo) {
|
||||||
analytics.trackPurchase({
|
analytics.trackPurchase({
|
||||||
uuid: data.user._id,
|
uuid: data.user._id,
|
||||||
|
|
@ -184,11 +186,10 @@ async function createSubscription (data) {
|
||||||
gift: Boolean(data.gift),
|
gift: Boolean(data.gift),
|
||||||
purchaseValue: block.price,
|
purchaseValue: block.price,
|
||||||
headers: data.headers,
|
headers: data.headers,
|
||||||
|
firstPurchase: !group && data.user.purchased.txnCount === 1,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!group && !data.promo) data.user.purchased.txnCount += 1;
|
|
||||||
|
|
||||||
if (data.gift) {
|
if (data.gift) {
|
||||||
const byUserName = getUserInfo(data.user, ['name']).name;
|
const byUserName = getUserInfo(data.user, ['name']).name;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue