Merge pull request #16244 from overleaf/mf-website-redesign-analytics

[web] Implement analytics that will be used for the website-redesign split test analysis

GitOrigin-RevId: 49bc0fe2049a5bf2ff676dfde93c1396002735c2
This commit is contained in:
M Fahru 2024-01-11 10:49:55 -07:00 committed by Copybot
parent 74421b3785
commit ded18dd09b
3 changed files with 12 additions and 0 deletions

View file

@ -58,6 +58,7 @@ module.exports = HomeController = {
)
AnalyticsManager.recordEventForSession(req.session, 'home-page-view', {
page: req.url,
'website-redesign': websiteRedesignVariant,
})
if (websiteRedesignActive) {

View file

@ -110,6 +110,9 @@ async function plansPage(req, res) {
)
}
const websiteRedesignVariant =
res.locals.splitTestVariants?.['website-redesign']
const plansPageViewSegmentation = {
currency: recommendedCurrency,
countryCode,
@ -122,6 +125,7 @@ async function plansPage(req, res) {
? 'latam'
: 'default',
'annual-trials': annualTrialsAssignment.variant,
'website-redesign': websiteRedesignVariant,
}
if (inrGeoBannerSplitTestName) {
plansPageViewSegmentation[inrGeoBannerSplitTestName] = inrGeoBannerVariant

View file

@ -43,10 +43,17 @@ async function recordRegistrationEvent(user) {
'onboarding-flow'
)
const websiteRedesignAssignment =
await SplitTestHandler.promises.getAssignmentForUser(
user._id,
'website-redesign'
)
try {
const segmentation = {
'home-registration': 'default',
'onboarding-flow': onboardingFlowAssignment.variant,
'website-redesign': websiteRedesignAssignment.variant,
}
if (user.thirdPartyIdentifiers && user.thirdPartyIdentifiers.length > 0) {
segmentation.provider = user.thirdPartyIdentifiers[0].providerId