Browse Source

feat(mobile-exp): adds some tracking for project and performance pages (#41870)

Track project and platform on project detail page and track tab for
performance landing page. For use in tracking mobile usage.
edwardgou-sentry 2 years ago
parent
commit
b9dd3aadee
2 changed files with 14 additions and 0 deletions
  1. 2 0
      static/app/views/performance/content.tsx
  2. 12 0
      static/app/views/projectDetail/index.tsx

+ 2 - 0
static/app/views/performance/content.tsx

@@ -25,6 +25,7 @@ import usePrevious from 'sentry/utils/usePrevious';
 import useProjects from 'sentry/utils/useProjects';
 import withPageFilters from 'sentry/utils/withPageFilters';
 
+import {getLandingDisplayFromParam} from './landing/utils';
 import {DEFAULT_STATS_PERIOD, generatePerformanceEventView} from './data';
 import {PerformanceLanding} from './landing';
 import {
@@ -97,6 +98,7 @@ function PerformanceContent({selection, location, demoMode, router}: Props) {
   useRouteAnalyticsParams({
     project_platforms: getSelectedProjectPlatforms(location, projects),
     show_onboarding: onboardingProject !== undefined,
+    tab: getLandingDisplayFromParam(location)?.field,
   });
 
   useEffect(() => {

+ 12 - 0
static/app/views/projectDetail/index.tsx

@@ -1,3 +1,5 @@
+import useRouteAnalyticsParams from 'sentry/utils/routeAnalytics/useRouteAnalyticsParams';
+import useProjects from 'sentry/utils/useProjects';
 import withOrganization from 'sentry/utils/withOrganization';
 
 import ProjectDetail from './projectDetail';
@@ -8,6 +10,16 @@ function ProjectDetailContainer(
     'projects' | 'loadingProjects' | 'selection'
   >
 ) {
+  const {projects} = useProjects();
+  const project = projects.find(p => p.slug === props.params.projectId);
+  useRouteAnalyticsParams(
+    project
+      ? {
+          project_id: project.id,
+          project_platform: project.platform,
+        }
+      : {}
+  );
   return <ProjectDetail {...props} />;
 }