diff --git a/website/common/script/fns/randomDrop.js b/website/common/script/fns/randomDrop.js index 1a29cf4fe3..283bb7c3b3 100644 --- a/website/common/script/fns/randomDrop.js +++ b/website/common/script/fns/randomDrop.js @@ -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) { diff --git a/website/server/libs/analyticsService.js b/website/server/libs/analyticsService.js index 4287abaae1..995a911fd5 100644 --- a/website/server/libs/analyticsService.js +++ b/website/server/libs/analyticsService.js @@ -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;