growthAnalyticsEvents.tsx 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. import {PlatformKey} from 'sentry/data/platformCategories';
  2. type MobilePromptBannerParams = {
  3. matchedUserAgentString: string;
  4. };
  5. type PlatformParam = {
  6. platform: PlatformKey;
  7. };
  8. type PlatformCategory = {
  9. category: string;
  10. source?: string;
  11. };
  12. type PlatformPickerParam = {
  13. platform_id: string;
  14. source?: string;
  15. };
  16. type PlatformSearchParam = {
  17. num_results: number;
  18. search: string;
  19. source?: string;
  20. };
  21. type SampleEventParam = {
  22. platform?: PlatformKey;
  23. };
  24. type InviteRequestParam = {
  25. invite_status: string;
  26. member_id: number;
  27. };
  28. type InviteModal = {
  29. modal_session: string;
  30. };
  31. type SampleEvent = {
  32. duration: number;
  33. interval: number;
  34. platform: string;
  35. project_id: string;
  36. retries: number;
  37. source: string;
  38. };
  39. type VitalsAlert = {
  40. can_see_all_projects: boolean;
  41. industry_diff: number;
  42. sentry_diff: number;
  43. user_vital_count: number;
  44. user_vital_value: number;
  45. vital: string;
  46. vitals_type: 'mobile' | 'web';
  47. };
  48. // define the event key to payload mappings
  49. export type GrowthEventParameters = {
  50. 'growth.clicked_enter_sandbox': {
  51. scenario: string;
  52. source?: string;
  53. };
  54. 'growth.clicked_mobile_prompt_ask_teammate': MobilePromptBannerParams;
  55. 'growth.clicked_mobile_prompt_setup_project': MobilePromptBannerParams;
  56. 'growth.clicked_sidebar': {
  57. item: string;
  58. };
  59. 'growth.demo_click_docs': {};
  60. 'growth.demo_click_get_started': {cta?: string};
  61. 'growth.demo_click_request_demo': {};
  62. 'growth.demo_modal_clicked_continue': {};
  63. 'growth.demo_modal_clicked_signup': {};
  64. 'growth.issue_open_in_discover_btn_clicked': {};
  65. 'growth.metric_alert_preset_sidebar_clicked': {
  66. preset: string;
  67. };
  68. 'growth.metric_alert_preset_use_template': {
  69. preset: string;
  70. };
  71. 'growth.onboarding_clicked_instrument_app': {source?: string};
  72. 'growth.onboarding_clicked_project_in_sidebar': {platform: string};
  73. 'growth.onboarding_clicked_setup_platform_later': PlatformParam & {
  74. project_index: number;
  75. };
  76. 'growth.onboarding_clicked_skip': {source?: string};
  77. 'growth.onboarding_load_choose_platform': {};
  78. 'growth.onboarding_quick_start_cta': SampleEventParam;
  79. 'growth.onboarding_set_up_your_project': PlatformParam;
  80. 'growth.onboarding_set_up_your_projects': {platform_count: number; platforms: string};
  81. 'growth.onboarding_start_onboarding': {
  82. source?: string;
  83. };
  84. 'growth.onboarding_take_to_error': {};
  85. 'growth.onboarding_view_full_docs': {};
  86. 'growth.onboarding_view_sample_event': SampleEventParam;
  87. 'growth.platformpicker_category': PlatformCategory;
  88. 'growth.platformpicker_search': PlatformSearchParam;
  89. 'growth.sample_error_onboarding_link_clicked': {
  90. platform?: string;
  91. project_id?: string;
  92. };
  93. 'growth.sample_transaction_docs_link_clicked': {
  94. project_id: string;
  95. };
  96. 'growth.select_platform': PlatformPickerParam;
  97. 'growth.submitted_mobile_prompt_ask_teammate': MobilePromptBannerParams;
  98. 'invite_modal.add_more': InviteModal;
  99. 'invite_modal.closed': InviteModal;
  100. 'invite_modal.invites_sent': InviteModal;
  101. 'invite_modal.opened': InviteModal & {
  102. can_invite: boolean;
  103. source?: string;
  104. };
  105. 'invite_modal.requests_sent': InviteModal;
  106. 'invite_request.approved': InviteRequestParam;
  107. 'invite_request.denied': InviteRequestParam;
  108. 'member_settings_page.loaded': {
  109. num_invite_requests: number;
  110. num_members: number;
  111. };
  112. 'onboarding.wizard_clicked': {
  113. action: string;
  114. todo_id: string;
  115. todo_title: string;
  116. };
  117. 'onboarding.wizard_opened': {};
  118. 'sample_event.button_viewed': {
  119. project_id: string;
  120. source: string;
  121. };
  122. 'sample_event.created': SampleEvent;
  123. 'sample_event.failed': SampleEvent;
  124. 'sdk_updates.clicked': {};
  125. 'sdk_updates.seen': {};
  126. 'sdk_updates.snoozed': {};
  127. 'vitals_alert.clicked_docs': VitalsAlert;
  128. 'vitals_alert.clicked_see_vitals': VitalsAlert;
  129. 'vitals_alert.dismissed': VitalsAlert;
  130. 'vitals_alert.displayed': VitalsAlert;
  131. };
  132. type GrowthAnalyticsKey = keyof GrowthEventParameters;
  133. export const growthEventMap: Record<GrowthAnalyticsKey, string | null> = {
  134. 'growth.clicked_mobile_prompt_setup_project':
  135. 'Growth: Clicked Mobile Prompt Setup Project',
  136. 'growth.clicked_mobile_prompt_ask_teammate':
  137. 'Growth: Clicked Mobile Prompt Ask Teammate',
  138. 'growth.submitted_mobile_prompt_ask_teammate':
  139. 'Growth: Submitted Mobile Prompt Ask Teammate',
  140. 'growth.demo_click_get_started': 'Growth: Demo Click Get Started',
  141. 'growth.demo_click_docs': 'Growth: Demo Click Docs',
  142. 'growth.demo_click_request_demo': 'Growth: Demo Click Request Demo',
  143. 'growth.clicked_sidebar': 'Growth: Clicked Sidebar',
  144. 'growth.onboarding_load_choose_platform':
  145. 'Growth: Onboarding Load Choose Platform Page',
  146. 'growth.onboarding_set_up_your_project': 'Growth: Onboarding Click Set Up Your Project',
  147. 'growth.onboarding_set_up_your_projects':
  148. 'Growth: Onboarding Click Set Up Your Projects',
  149. 'growth.select_platform': 'Growth: Onboarding Choose Platform',
  150. 'growth.platformpicker_category': 'Growth: Onboarding Platform Category',
  151. 'growth.platformpicker_search': 'Growth: Onboarding Platform Search',
  152. 'growth.metric_alert_preset_use_template': 'Growth: Metric Alert Preset Use Template',
  153. 'growth.metric_alert_preset_sidebar_clicked':
  154. 'Growth: Metric Alert Preset Sidebar Clicked',
  155. 'growth.onboarding_start_onboarding': 'Growth: Onboarding Start Onboarding',
  156. 'growth.onboarding_clicked_skip': 'Growth: Onboarding Clicked Skip',
  157. 'growth.onboarding_take_to_error': 'Growth: Onboarding Take to Error',
  158. 'growth.onboarding_view_full_docs': 'Growth: Onboarding View Full Docs',
  159. 'growth.onboarding_view_sample_event': 'Growth: Onboarding View Sample Event',
  160. 'growth.onboarding_clicked_instrument_app': 'Growth: Onboarding Clicked Instrument App',
  161. 'growth.onboarding_clicked_setup_platform_later':
  162. 'Growth: Onboarding Clicked Setup Platform Later',
  163. 'growth.onboarding_quick_start_cta': 'Growth: Quick Start Onboarding CTA',
  164. 'invite_request.approved': 'Invite Request Approved',
  165. 'invite_request.denied': 'Invite Request Denied',
  166. 'growth.demo_modal_clicked_signup': 'Growth: Demo Modal Clicked Signup',
  167. 'growth.demo_modal_clicked_continue': 'Growth: Demo Modal Clicked Continue',
  168. 'growth.clicked_enter_sandbox': 'Growth: Clicked Enter Sandbox',
  169. 'growth.onboarding_clicked_project_in_sidebar': 'Growth: Clicked Project Sidebar',
  170. 'growth.sample_transaction_docs_link_clicked':
  171. 'Growth: Sample Transaction Docs Link Clicked',
  172. 'growth.sample_error_onboarding_link_clicked':
  173. 'Growth: Sample Error Onboarding Link Clicked',
  174. 'growth.issue_open_in_discover_btn_clicked':
  175. 'Growth: Open in Discover Button in Issue Details clicked',
  176. 'member_settings_page.loaded': 'Member Settings Page Loaded',
  177. 'invite_modal.opened': 'Invite Modal: Opened',
  178. 'invite_modal.closed': 'Invite Modal: Closed',
  179. 'invite_modal.add_more': 'Invite Modal: Add More',
  180. 'invite_modal.invites_sent': 'Invite Modal: Invites Sent',
  181. 'invite_modal.requests_sent': 'Invite Modal: Requests Sent',
  182. 'sdk_updates.seen': 'SDK Updates: Seen',
  183. 'sdk_updates.snoozed': 'SDK Updates: Snoozed',
  184. 'sdk_updates.clicked': 'SDK Updates: Clicked',
  185. 'onboarding.wizard_opened': 'Onboarding Wizard Opened',
  186. 'onboarding.wizard_clicked': 'Onboarding Wizard Clicked',
  187. 'sample_event.button_viewed': null, // high-volume event
  188. 'sample_event.created': 'Sample Event Created',
  189. 'sample_event.failed': 'Sample Event Failed',
  190. 'vitals_alert.clicked_see_vitals': 'Vitals Alert: Clicked See Vitals',
  191. 'vitals_alert.dismissed': 'Vitals Alert: Dismissed',
  192. 'vitals_alert.clicked_docs': 'Vitals Alert: Clicked Docs',
  193. 'vitals_alert.displayed': 'Vitals Alert: Displayed',
  194. };