Add onboarding-flow in "register" and "user-registered" events (#15651)

* onboarding-flow in register event

* onboarding-flow in user-registered event

* fix typos

GitOrigin-RevId: aff8a7157062db0ec1c99499353a7c08eaa7b8b6
This commit is contained in:
Domagoj Kriskovic 2023-11-10 11:51:45 +01:00 committed by Copybot
parent 3ff58aa318
commit 9ce9b2c937
2 changed files with 9 additions and 1 deletions

View file

@ -67,8 +67,9 @@ module.exports = HomeController = {
return res.render('external/home/v2', { return res.render('external/home/v2', {
designSystemUpdatesVariant: designSystemUpdatesAssignment.variant, designSystemUpdatesVariant: designSystemUpdatesAssignment.variant,
onboardingFlowVariant: onboardingFlowAssignment.variant,
hideNewsletterCheckbox: hideNewsletterCheckbox:
onboardingFlowAssignment?.variant === 'token-confirmation-odc', onboardingFlowAssignment.variant === 'token-confirmation-odc',
}) })
} else { } else {
return res.redirect('/login') return res.redirect('/login')

View file

@ -51,10 +51,17 @@ async function recordRegistrationEvent(user) {
) )
} }
const onboardingFlowAssignment =
await SplitTestHandler.promises.getAssignmentForUser(
user._id,
'onboarding-flow'
)
try { try {
const segmentation = { const segmentation = {
'home-registration': 'default', 'home-registration': 'default',
'split-test-design-system-updates': designSystemUpdatesAssignment.variant, 'split-test-design-system-updates': designSystemUpdatesAssignment.variant,
'onboarding-flow': onboardingFlowAssignment.variant,
} }
if (user.thirdPartyIdentifiers && user.thirdPartyIdentifiers.length > 0) { if (user.thirdPartyIdentifiers && user.thirdPartyIdentifiers.length > 0) {
segmentation.provider = user.thirdPartyIdentifiers[0].providerId segmentation.provider = user.thirdPartyIdentifiers[0].providerId