Add new event segmentations for upgrade button in dashboard to help analytics (#11345)

* Add new event segmentations for the upgrade button in dashboard to help analysis

* Also add an extra check for the upgrade button in the navbar since it's only appeared in the project dashboard react version

GitOrigin-RevId: fca14e3adfbafd0fd143b045ba43588913f7297b
This commit is contained in:
M Fahru 2023-01-23 09:08:00 -07:00 committed by Copybot
parent ea02de3e28
commit 435be3073f
5 changed files with 12 additions and 4 deletions

View file

@ -355,6 +355,7 @@ async function projectListReactPage(req, res, next) {
showGroupsAndEnterpriseBanner,
groupsAndEnterpriseBannerVariant:
groupsAndEnterpriseBannerAssignment?.variant ?? 'default',
projectDashboardReact: true, // used in navbar
showNewUsersMicroSurvey,
})
}

View file

@ -9,14 +9,15 @@ nav.navbar.navbar-default.navbar-main
aria-label="Toggle " + translate('navigation')
)
i.fa.fa-bars(aria-hidden="true")
if (usersBestSubscription && usersBestSubscription.type === 'free')
- var enableUpgradeButton = projectDashboardReact && usersBestSubscription && usersBestSubscription.type === 'free'
if (enableUpgradeButton)
a.btn.btn-primary.pull-right.me-2.visible-xs(
href="/user/subscription/plans"
event-tracking="upgrade-button-click"
event-tracking-mb="true"
event-tracking-label="upgrade"
event-tracking-trigger="click"
event-segmentation='{"source": "dashboard-top"}'
event-segmentation='{"source": "dashboard-top", "project-dashboard-react": "enabled", "is-dashboard-sidebar-hidden": "true"}'
) #{translate("upgrade")}
if settings.nav.custom_logo
a(href='/', aria-label=settings.appName, style='background-image:url("'+settings.nav.custom_logo+'")').navbar-brand

View file

@ -112,5 +112,5 @@ mixin free_plan()
event-tracking-mb="true"
event-tracking-label="upgrade"
event-tracking-trigger="click"
event-segmentation='{"source": "dashboard-top"}'
event-segmentation='{"source": "dashboard-top", "project-dashboard-react": "default", "is-dashboard-sidebar-hidden": "false"}'
) Upgrade

View file

@ -14,7 +14,11 @@ function FreePlan({ featuresPageURL }: FreePlanProps) {
)
const handleClick = () => {
eventTracking.sendMB('upgrade-button-click', { source: 'dashboard-top' })
eventTracking.sendMB('upgrade-button-click', {
source: 'dashboard-top',
'project-dashboard-react': 'enabled',
'is-dashboard-sidebar-hidden': false,
})
}
const featuresPageVariant = getMeta('ol-splitTestVariants')?.['features-page']

View file

@ -53,6 +53,8 @@ describe('<CurrentPlanWidget />', function () {
expect(sendMBSpy).calledWith('upgrade-button-click', {
source: 'dashboard-top',
page: '/',
'project-dashboard-react': 'enabled',
'is-dashboard-sidebar-hidden': false,
})
})
})