Browse Source

ref(analytics): convert more analytics (#47599)

This converts an arbitrary set of analytics events to the new
`trackAnalytics` function which is just `trackAdvancedAnalyticsEvent`.
Stephen Cefali 1 year ago
parent
commit
a9f464b36b

+ 4 - 4
static/app/components/actions/resolve.tsx

@@ -18,7 +18,7 @@ import {
   ResolutionStatus,
   ResolutionStatusDetails,
 } from 'sentry/types';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 import {formatVersion} from 'sentry/utils/formatters';
 import withOrganization from 'sentry/utils/withOrganization';
 
@@ -63,7 +63,7 @@ class ResolveActions extends Component<Props> {
       status: ResolutionStatus.RESOLVED,
       statusDetails,
     });
-    trackAdvancedAnalyticsEvent('resolve_issue', {
+    trackAnalytics('resolve_issue', {
       organization,
       release: 'anotherExisting',
     });
@@ -78,7 +78,7 @@ class ResolveActions extends Component<Props> {
           inRelease: latestRelease ? latestRelease.version : 'latest',
         },
       });
-    trackAdvancedAnalyticsEvent('resolve_issue', {
+    trackAnalytics('resolve_issue', {
       organization,
       release: 'current',
     });
@@ -93,7 +93,7 @@ class ResolveActions extends Component<Props> {
           inNextRelease: true,
         },
       });
-    trackAdvancedAnalyticsEvent('resolve_issue', {
+    trackAnalytics('resolve_issue', {
       organization,
       release: 'next',
     });

+ 2 - 2
static/app/components/modals/commandPalette.tsx

@@ -7,14 +7,14 @@ import Input from 'sentry/components/input';
 import {Search} from 'sentry/components/search';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 
 function CommandPalette({Body}: ModalRenderProps) {
   const theme = useTheme();
 
   useEffect(
     () =>
-      void trackAdvancedAnalyticsEvent('omnisearch.open', {
+      void trackAnalytics('omnisearch.open', {
         organization: null,
       }),
     []

+ 5 - 8
static/app/components/modals/dashboardWidgetQuerySelectorModal.tsx

@@ -11,7 +11,7 @@ import {IconChevron, IconSearch} from 'sentry/icons';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import {Organization, PageFilters} from 'sentry/types';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 import withApi from 'sentry/utils/withApi';
 import withPageFilters from 'sentry/utils/withPageFilters';
 import {Widget} from 'sentry/views/dashboards/types';
@@ -58,13 +58,10 @@ class DashboardWidgetQuerySelectorModal extends Component<Props> {
                 priority="primary"
                 icon={<IconChevron size="xs" direction="right" />}
                 onClick={() => {
-                  trackAdvancedAnalyticsEvent(
-                    'dashboards_views.query_selector.selected',
-                    {
-                      organization,
-                      widget_type: widget.displayType,
-                    }
-                  );
+                  trackAnalytics('dashboards_views.query_selector.selected', {
+                    organization,
+                    widget_type: widget.displayType,
+                  });
                 }}
                 aria-label={t('Open in Discover')}
               />

+ 5 - 5
static/app/components/modals/demoEndModal.tsx

@@ -11,7 +11,7 @@ import {IconClose} from 'sentry/icons/iconClose';
 import {t} from 'sentry/locale';
 import SidebarPanelStore from 'sentry/stores/sidebarPanelStore';
 import {Organization} from 'sentry/types';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 import useApi from 'sentry/utils/useApi';
 import {useNavigate} from 'sentry/utils/useNavigate';
 
@@ -80,7 +80,7 @@ export default function DemoEndingModal({tour, closeModal, CloseButton, orgSlug}
       )
     );
 
-    trackAdvancedAnalyticsEvent('growth.end_modal_restart_tours', {
+    trackAnalytics('growth.end_modal_restart_tours', {
       organization: null,
     });
 
@@ -94,7 +94,7 @@ export default function DemoEndingModal({tour, closeModal, CloseButton, orgSlug}
   const handleMoreTours = () => {
     closeModal?.();
     SidebarPanelStore.togglePanel(SidebarPanelKey.OnboardingWizard);
-    trackAdvancedAnalyticsEvent('growth.end_modal_more_tours', {
+    trackAnalytics('growth.end_modal_more_tours', {
       organization: null,
     });
   };
@@ -104,7 +104,7 @@ export default function DemoEndingModal({tour, closeModal, CloseButton, orgSlug}
       <CloseButton
         size="zero"
         onClick={() => {
-          trackAdvancedAnalyticsEvent('growth.end_modal_close', {
+          trackAnalytics('growth.end_modal_close', {
             organization: null,
           });
           if (closeModal) {
@@ -123,7 +123,7 @@ export default function DemoEndingModal({tour, closeModal, CloseButton, orgSlug}
           external
           href={url}
           onClick={() => {
-            trackAdvancedAnalyticsEvent('growth.end_modal_signup', {
+            trackAnalytics('growth.end_modal_signup', {
               organization: null,
             });
           }}

+ 4 - 4
static/app/components/modals/demoSignUp.tsx

@@ -10,7 +10,7 @@ import HighlightCornerContainer from 'sentry/components/highlightCornerModal';
 import {IconClose} from 'sentry/icons';
 import {t} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 import {extraQueryParameter, urlAttachQueryParams} from 'sentry/utils/demoMode';
 
 type Props = ModalRenderProps;
@@ -32,7 +32,7 @@ function DemoSignUpModal({closeModal}: Props) {
         size="xs"
         aria-label={t('Close')}
         onClick={() => {
-          trackAdvancedAnalyticsEvent('growth.demo_modal_clicked_close', {
+          trackAnalytics('growth.demo_modal_clicked_close', {
             organization: null,
           });
           closeModal();
@@ -53,7 +53,7 @@ function DemoSignUpModal({closeModal}: Props) {
             priority="primary"
             href={signupUrl}
             onClick={() =>
-              trackAdvancedAnalyticsEvent('growth.demo_modal_clicked_signup', {
+              trackAnalytics('growth.demo_modal_clicked_signup', {
                 organization: null,
               })
             }
@@ -64,7 +64,7 @@ function DemoSignUpModal({closeModal}: Props) {
             priority="default"
             href={demoUrl}
             onClick={() =>
-              trackAdvancedAnalyticsEvent('growth.demo_modal_clicked_demo', {
+              trackAnalytics('growth.demo_modal_clicked_demo', {
                 organization: null,
               })
             }

+ 5 - 5
static/app/components/modals/inviteMembersModal/index.tsx

@@ -14,7 +14,7 @@ import {IconAdd, IconCheckmark, IconWarning} from 'sentry/icons';
 import {t, tct, tn} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import {Organization} from 'sentry/types';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 import {uniqueId} from 'sentry/utils/guid';
 import withLatestContext from 'sentry/utils/withLatestContext';
 
@@ -63,7 +63,7 @@ class InviteMembersModal extends AsyncComponent<Props, State> {
     this.sessionId = uniqueId();
 
     const {organization, source} = this.props;
-    trackAdvancedAnalyticsEvent('invite_modal.opened', {
+    trackAnalytics('invite_modal.opened', {
       organization,
       modal_session: this.sessionId,
       can_invite: this.willInvite,
@@ -104,7 +104,7 @@ class InviteMembersModal extends AsyncComponent<Props, State> {
       complete: false,
       sendingInvites: false,
     });
-    trackAdvancedAnalyticsEvent('invite_modal.add_more', {
+    trackAnalytics('invite_modal.add_more', {
       organization: this.props.organization,
       modal_session: this.sessionId,
     });
@@ -158,7 +158,7 @@ class InviteMembersModal extends AsyncComponent<Props, State> {
     await Promise.all(this.invites.map(this.sendInvite));
     this.setState({sendingInvites: false, complete: true});
 
-    trackAdvancedAnalyticsEvent(
+    trackAnalytics(
       this.willInvite ? 'invite_modal.invites_sent' : 'invite_modal.requests_sent',
       {
         organization: this.props.organization,
@@ -388,7 +388,7 @@ class InviteMembersModal extends AsyncComponent<Props, State> {
                     priority="primary"
                     size="sm"
                     onClick={() => {
-                      trackAdvancedAnalyticsEvent('invite_modal.closed', {
+                      trackAnalytics('invite_modal.closed', {
                         organization: this.props.organization,
                         modal_session: this.sessionId,
                       });

+ 2 - 2
static/app/components/modals/savedSearchModal/createSavedSearchModal.tsx

@@ -8,7 +8,7 @@ import {OnSubmitCallback} from 'sentry/components/forms/types';
 import {SavedSearchModalContent} from 'sentry/components/modals/savedSearchModal/savedSearchModalContent';
 import {t} from 'sentry/locale';
 import {Organization, SavedSearchType, SavedSearchVisibility} from 'sentry/types';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 import {useCreateSavedSearch} from 'sentry/views/issueList/mutations/useCreateSavedSearch';
 import {IssueSortOptions} from 'sentry/views/issueList/utils';
 
@@ -76,7 +76,7 @@ export function CreateSavedSearchModal({
 
     addLoadingMessage(t('Saving Changes'));
 
-    trackAdvancedAnalyticsEvent('search.saved_search_create', {
+    trackAnalytics('search.saved_search_create', {
       name: data.name,
       organization,
       query: data.query,

+ 4 - 4
static/app/components/modals/suggestProjectModal.tsx

@@ -21,7 +21,7 @@ import ListItem from 'sentry/components/list/listItem';
 import {t, tct} from 'sentry/locale';
 import {space} from 'sentry/styles/space';
 import {Organization} from 'sentry/types';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 import withApi from 'sentry/utils/withApi';
 
 type Props = ModalRenderProps & {
@@ -41,7 +41,7 @@ class SuggestProjectModal extends Component<Props, State> {
 
   handleGetStartedClick = () => {
     const {matchedUserAgentString, organization} = this.props;
-    trackAdvancedAnalyticsEvent('growth.clicked_mobile_prompt_setup_project', {
+    trackAnalytics('growth.clicked_mobile_prompt_setup_project', {
       matchedUserAgentString,
       organization,
     });
@@ -50,7 +50,7 @@ class SuggestProjectModal extends Component<Props, State> {
   handleAskTeammate = () => {
     const {matchedUserAgentString, organization} = this.props;
     this.setState({askTeammate: true});
-    trackAdvancedAnalyticsEvent('growth.clicked_mobile_prompt_ask_teammate', {
+    trackAnalytics('growth.clicked_mobile_prompt_ask_teammate', {
       matchedUserAgentString,
       organization,
     });
@@ -63,7 +63,7 @@ class SuggestProjectModal extends Component<Props, State> {
   handleSubmitSuccess = () => {
     const {matchedUserAgentString, organization, closeModal} = this.props;
     addSuccessMessage('Notified teammate successfully');
-    trackAdvancedAnalyticsEvent('growth.submitted_mobile_prompt_ask_teammate', {
+    trackAnalytics('growth.submitted_mobile_prompt_ask_teammate', {
       matchedUserAgentString,
       organization,
     });

+ 17 - 23
static/app/components/modals/widgetViewerModal.tsx

@@ -32,7 +32,7 @@ import {space} from 'sentry/styles/space';
 import {Organization, PageFilters, SelectValue} from 'sentry/types';
 import {Series} from 'sentry/types/echarts';
 import {defined} from 'sentry/utils';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 import {getUtcDateString} from 'sentry/utils/dates';
 import {TableDataWithTitle} from 'sentry/utils/discover/discoverQuery';
 import EventView from 'sentry/utils/discover/eventView';
@@ -457,7 +457,7 @@ function WidgetViewerModal(props: Props) {
         ),
       },
     });
-    trackAdvancedAnalyticsEvent('dashboards_views.widget_viewer.toggle_legend', {
+    trackAnalytics('dashboards_views.widget_viewer.toggle_legend', {
       organization,
       widget_type: widget.widgetType ?? WidgetType.DISCOVER,
       display_type: widget.displayType,
@@ -521,7 +521,7 @@ function WidgetViewerModal(props: Props) {
                 setChartUnmodified(false);
               }
 
-              trackAdvancedAnalyticsEvent('dashboards_views.widget_viewer.paginate', {
+              trackAnalytics('dashboards_views.widget_viewer.paginate', {
                 organization,
                 widget_type: WidgetType.DISCOVER,
                 display_type: widget.displayType,
@@ -596,7 +596,7 @@ function WidgetViewerModal(props: Props) {
                 setChartUnmodified(false);
               }
 
-              trackAdvancedAnalyticsEvent('dashboards_views.widget_viewer.paginate', {
+              trackAnalytics('dashboards_views.widget_viewer.paginate', {
                 organization,
                 widget_type: WidgetType.ISSUE,
                 display_type: widget.displayType,
@@ -659,7 +659,7 @@ function WidgetViewerModal(props: Props) {
                     [WidgetViewerQueryField.CURSOR]: newCursor,
                   },
                 });
-                trackAdvancedAnalyticsEvent('dashboards_views.widget_viewer.paginate', {
+                trackAnalytics('dashboards_views.widget_viewer.paginate', {
                   organization,
                   widget_type: WidgetType.RELEASE,
                   display_type: widget.displayType,
@@ -711,7 +711,7 @@ function WidgetViewerModal(props: Props) {
         [WidgetViewerQueryField.END]: newEnd,
       },
     });
-    trackAdvancedAnalyticsEvent('dashboards_views.widget_viewer.zoom', {
+    trackAnalytics('dashboards_views.widget_viewer.zoom', {
       organization,
       widget_type: widget.widgetType ?? WidgetType.DISCOVER,
       display_type: widget.displayType,
@@ -898,14 +898,11 @@ function WidgetViewerModal(props: Props) {
                   },
                 });
 
-                trackAdvancedAnalyticsEvent(
-                  'dashboards_views.widget_viewer.select_query',
-                  {
-                    organization,
-                    widget_type: widget.widgetType ?? WidgetType.DISCOVER,
-                    display_type: widget.displayType,
-                  }
-                );
+                trackAnalytics('dashboards_views.widget_viewer.select_query', {
+                  organization,
+                  widget_type: widget.widgetType ?? WidgetType.DISCOVER,
+                  display_type: widget.displayType,
+                });
               }}
               components={{
                 // Replaces the displayed selected value
@@ -1028,14 +1025,11 @@ function WidgetViewerModal(props: Props) {
                             onClick={() => {
                               closeModal();
                               onEdit();
-                              trackAdvancedAnalyticsEvent(
-                                'dashboards_views.widget_viewer.edit',
-                                {
-                                  organization,
-                                  widget_type: widget.widgetType ?? WidgetType.DISCOVER,
-                                  display_type: widget.displayType,
-                                }
-                              );
+                              trackAnalytics('dashboards_views.widget_viewer.edit', {
+                                organization,
+                                widget_type: widget.widgetType ?? WidgetType.DISCOVER,
+                                display_type: widget.displayType,
+                              });
                             }}
                           >
                             {t('Edit Widget')}
@@ -1106,7 +1100,7 @@ function OpenButton({
       to={path}
       priority="primary"
       onClick={() => {
-        trackAdvancedAnalyticsEvent('dashboards_views.widget_viewer.open_source', {
+        trackAnalytics('dashboards_views.widget_viewer.open_source', {
           organization,
           widget_type: widget.widgetType ?? WidgetType.DISCOVER,
           display_type: widget.displayType,

+ 4 - 4
static/app/components/modals/widgetViewerModal/widgetViewerTableCell.tsx

@@ -10,7 +10,7 @@ import {Tooltip} from 'sentry/components/tooltip';
 import {t} from 'sentry/locale';
 import {Organization, PageFilters} from 'sentry/types';
 import {defined} from 'sentry/utils';
-import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {trackAnalytics} from 'sentry/utils/analytics';
 import {
   getIssueFieldRenderer,
   getSortField,
@@ -83,7 +83,7 @@ export const renderIssueGridHeaderCell = ({
         })}
         onClick={() => {
           onHeaderClick?.();
-          trackAdvancedAnalyticsEvent('dashboards_views.widget_viewer.sort', {
+          trackAnalytics('dashboards_views.widget_viewer.sort', {
             organization,
             widget_type: WidgetType.ISSUE,
             display_type: widget.displayType,
@@ -157,7 +157,7 @@ export const renderDiscoverGridHeaderCell = ({
         generateSortLink={generateSortLink}
         onClick={() => {
           onHeaderClick?.();
-          trackAdvancedAnalyticsEvent('dashboards_views.widget_viewer.sort', {
+          trackAnalytics('dashboards_views.widget_viewer.sort', {
             organization,
             widget_type: WidgetType.DISCOVER,
             display_type: widget.displayType,
@@ -326,7 +326,7 @@ export const renderReleaseGridHeaderCell = ({
         generateSortLink={generateSortLink}
         onClick={() => {
           onHeaderClick?.();
-          trackAdvancedAnalyticsEvent('dashboards_views.widget_viewer.sort', {
+          trackAnalytics('dashboards_views.widget_viewer.sort', {
             organization,
             widget_type: WidgetType.RELEASE,
             display_type: widget.displayType,

Some files were not shown because too many files changed in this diff