From eb81b2b6de4fbf6773f9c1bb9cd1995ffbb0b0cb Mon Sep 17 00:00:00 2001 From: Alexandre Bourdin Date: Thu, 12 May 2022 11:33:54 +0200 Subject: [PATCH] Merge pull request #7010 from overleaf/ab-mixpanel-backfill-program [web] Skip backfilling user program membership if not set GitOrigin-RevId: a8193ee7701cd3229f1eafef23d7d0ed87e9aedc --- .../web/scripts/backfill_mixpanel_user_properties.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/services/web/scripts/backfill_mixpanel_user_properties.js b/services/web/scripts/backfill_mixpanel_user_properties.js index ebd23f1f63..8ab9ca22e6 100644 --- a/services/web/scripts/backfill_mixpanel_user_properties.js +++ b/services/web/scripts/backfill_mixpanel_user_properties.js @@ -18,8 +18,12 @@ async function processUser(user) { await _sendPropertyToQueue(analyticsId, 'user-id', user._id) await _sendPropertyToQueue(analyticsId, 'analytics-id', analyticsId) await _sendPropertyToQueue(analyticsId, 'created-at', user.signUpDate) - await _sendPropertyToQueue(analyticsId, 'alpha-program', user.alphaProgram) - await _sendPropertyToQueue(analyticsId, 'beta-program', user.betaProgram) + if (user.alphaProgram !== undefined) { + await _sendPropertyToQueue(analyticsId, 'alpha-program', user.alphaProgram) + } + if (user.betaProgram !== undefined) { + await _sendPropertyToQueue(analyticsId, 'beta-program', user.betaProgram) + } const groupSubscriptionPlanCode = await _getGroupSubscriptionPlanCode( user._id @@ -77,6 +81,9 @@ async function _sendPropertyToQueue( propertyValue, createdAt = new Date() ) { + if (propertyValue == null) { + return + } await mixpanelSinkQueue.add('user-property', { analyticsId, propertyName,