Place redesign pages on seperate urls with redirects (#16724)

* Place redesign pages on seperate urls with redirects, refactor into StaticPageController

* Add page titles to variant pages (#16710)

* Add features-page-view event (#14911)

* Add canonical URLs to variant marketing pages

GitOrigin-RevId: 3f65f53d856a063dde1e9d60fd3cc327437294f6
This commit is contained in:
Thomas 2024-01-26 12:01:29 +01:00 committed by Copybot
parent 4f901caa2d
commit 17e4c776c1
2 changed files with 37 additions and 14 deletions

View file

@ -50,6 +50,10 @@ module.exports = HomeController = {
websiteRedesignVariant === 'new-design' ||
websiteRedesignVariant === 'new-design-registration'
if (websiteRedesignActive) {
return res.redirect(302, '/home-2')
}
const onboardingFlowAssignment =
await SplitTestHandler.promises.getAssignment(
req,
@ -57,23 +61,41 @@ module.exports = HomeController = {
'onboarding-flow'
)
AnalyticsManager.recordEventForSession(req.session, 'home-page-view', {
page: req.url,
page: req.path,
'website-redesign': websiteRedesignVariant,
})
if (websiteRedesignActive) {
return res.render('external/home/website-redesign/index', {
onboardingFlowVariant: onboardingFlowAssignment.variant,
hideNewsletterCheckbox:
onboardingFlowAssignment.variant === 'token-confirmation-odc',
})
} else {
return res.render('external/home/v2', {
onboardingFlowVariant: onboardingFlowAssignment.variant,
hideNewsletterCheckbox:
onboardingFlowAssignment.variant === 'token-confirmation-odc',
})
}
return res.render('external/home/v2', {
onboardingFlowVariant: onboardingFlowAssignment.variant,
hideNewsletterCheckbox:
onboardingFlowAssignment.variant === 'token-confirmation-odc',
})
} else {
return res.redirect('/login')
}
},
async homeNew(req, res) {
if (Features.hasFeature('homepage') && homepageExists) {
const websiteRedesignVariant =
res.locals.splitTestVariants?.['website-redesign']
const onboardingFlowAssignment =
await SplitTestHandler.promises.getAssignment(
req,
res,
'onboarding-flow'
)
AnalyticsManager.recordEventForSession(req.session, 'home-page-view', {
page: req.path,
'website-redesign': websiteRedesignVariant,
})
return res.render('external/home/website-redesign/index', {
onboardingFlowVariant: onboardingFlowAssignment.variant,
hideNewsletterCheckbox:
onboardingFlowAssignment.variant === 'token-confirmation-odc',
})
} else {
return res.redirect('/login')
}

View file

@ -15,6 +15,7 @@ module.exports = {
apply(webRouter) {
webRouter.get('/', HomeController.index)
webRouter.get('/home', HomeController.home)
webRouter.get('/home-2', HomeController.homeNew)
webRouter.get(
'/planned_maintenance',