diff --git a/static/app/components/nav/config.tsx b/static/app/components/nav/config.tsx index b0b058936d6881..723f612ead32ba 100644 --- a/static/app/components/nav/config.tsx +++ b/static/app/components/nav/config.tsx @@ -52,6 +52,7 @@ export function createNavConfig({organization}: {organization: Organization}): N label: t('Insights'), icon: , feature: {features: 'insights-entry-points'}, + analyticsKey: 'insights', submenu: [ { label: MODULE_TITLE_HTTP, @@ -94,6 +95,7 @@ export function createNavConfig({organization}: {organization: Organization}): N const perf: NavSidebarItem = { label: t('Perf.'), to: '/performance/', + analyticsKey: 'performance', icon: , feature: { features: 'performance-view', @@ -104,6 +106,7 @@ export function createNavConfig({organization}: {organization: Organization}): N const perfDomainViews: NavSidebarItem = { label: t('Perf.'), icon: , + analyticsKey: 'insights-domains', feature: {features: ['insights-domain-view', 'performance-view']}, submenu: [ { @@ -130,6 +133,7 @@ export function createNavConfig({organization}: {organization: Organization}): N { label: t('Issues'), icon: , + analyticsKey: 'issues', submenu: [ { label: t('All'), @@ -154,10 +158,16 @@ export function createNavConfig({organization}: {organization: Organization}): N {label: t('Feedback'), to: `/${prefix}/feedback/`}, ], }, - {label: t('Projects'), to: `/${prefix}/projects/`, icon: }, + { + label: t('Projects'), + analyticsKey: 'projects', + to: `/${prefix}/projects/`, + icon: , + }, { label: t('Explore'), icon: , + analyticsKey: 'explore', submenu: [ { label: t('Traces'), @@ -201,6 +211,7 @@ export function createNavConfig({organization}: {organization: Organization}): N ...(hasPerfDomainViews ? [perfDomainViews, perf] : [insights, perf]), { label: t('Boards'), + analyticsKey: 'customizable-dashboards', to: '/dashboards/', icon: , feature: { @@ -209,12 +220,18 @@ export function createNavConfig({organization}: {organization: Organization}): N requireAll: false, }, }, - {label: t('Alerts'), to: `/${prefix}/alerts/rules/`, icon: }, + { + label: t('Alerts'), + analyticsKey: 'alerts', + to: `/${prefix}/alerts/rules/`, + icon: , + }, ], footer: [ { label: t('Help'), icon: , + analyticsKey: 'help', dropdown: [ { key: 'search', @@ -242,6 +259,7 @@ export function createNavConfig({organization}: {organization: Organization}): N }, { label: t('Settings'), + analyticsKey: 'settings', to: `/settings/${organization.slug}/`, icon: , }, diff --git a/static/app/components/nav/index.spec.tsx b/static/app/components/nav/index.spec.tsx index 0ca7e1efb43bde..a94c20f1747c0c 100644 --- a/static/app/components/nav/index.spec.tsx +++ b/static/app/components/nav/index.spec.tsx @@ -2,7 +2,13 @@ import {LocationFixture} from 'sentry-fixture/locationFixture'; import {OrganizationFixture} from 'sentry-fixture/organization'; import {RouterFixture} from 'sentry-fixture/routerFixture'; -import {getAllByRole, render, screen} from 'sentry-test/reactTestingLibrary'; +import {trackAnalytics} from 'sentry/utils/analytics'; + +jest.mock('sentry/utils/analytics', () => ({ + trackAnalytics: jest.fn(), +})); + +import {getAllByRole, render, screen, userEvent} from 'sentry-test/reactTestingLibrary'; import Nav from 'sentry/components/nav'; @@ -165,4 +171,26 @@ describe('Nav', function () { }); }); }); + + describe('analytics', function () { + beforeEach(() => { + render(