growthAnalyticsEvents.tsx 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. // define the event key to payload mappings
  40. export type GrowthEventParameters = {
  41. 'assistant.guide_cued': {
  42. guide: string;
  43. };
  44. 'assistant.guide_dismissed': {
  45. guide: string;
  46. step: number;
  47. };
  48. 'assistant.guide_finished': {
  49. guide: string;
  50. };
  51. 'growth.clicked_enter_sandbox': {
  52. scenario: string;
  53. source?: string;
  54. };
  55. 'growth.clicked_mobile_prompt_ask_teammate': MobilePromptBannerParams;
  56. 'growth.clicked_mobile_prompt_setup_project': MobilePromptBannerParams;
  57. 'growth.clicked_sidebar': {
  58. item: string;
  59. };
  60. 'growth.demo_click_docs': {};
  61. 'growth.demo_click_get_started': {cta?: string};
  62. 'growth.demo_click_request_demo': {};
  63. 'growth.demo_modal_clicked_close': {};
  64. 'growth.demo_modal_clicked_continue': {};
  65. 'growth.demo_modal_clicked_demo': {};
  66. 'growth.demo_modal_clicked_signup': {};
  67. 'growth.metric_alert_preset_sidebar_clicked': {
  68. preset: string;
  69. };
  70. 'growth.metric_alert_preset_use_template': {
  71. preset: string;
  72. };
  73. 'growth.onboarding_clicked_instrument_app': {source?: string};
  74. 'growth.onboarding_clicked_project_in_sidebar': {platform: string};
  75. 'growth.onboarding_clicked_setup_platform_later': PlatformParam & {
  76. project_index: number;
  77. };
  78. 'growth.onboarding_clicked_skip': {source?: string};
  79. 'growth.onboarding_load_choose_platform': {};
  80. 'growth.onboarding_quick_start_cta': SampleEventParam;
  81. 'growth.onboarding_set_up_your_project': PlatformParam;
  82. 'growth.onboarding_set_up_your_projects': {platform_count: number; platforms: string};
  83. 'growth.onboarding_start_onboarding': {
  84. source?: string;
  85. };
  86. 'growth.onboarding_take_to_error': {};
  87. 'growth.onboarding_view_full_docs': {};
  88. 'growth.onboarding_view_sample_event': SampleEventParam;
  89. 'growth.onboarding_wizard_clicked_more_details': {
  90. platform?: string;
  91. project_id?: string;
  92. };
  93. 'growth.onboarding_wizard_interacted': {
  94. wizard_instructions: boolean;
  95. platform?: string;
  96. project_id?: string;
  97. };
  98. 'growth.platformpicker_category': PlatformCategory;
  99. 'growth.platformpicker_search': PlatformSearchParam;
  100. 'growth.sample_error_onboarding_link_clicked': {
  101. platform?: string;
  102. project_id?: string;
  103. };
  104. 'growth.sample_transaction_docs_link_clicked': {
  105. project_id: string;
  106. };
  107. 'growth.select_platform': PlatformPickerParam;
  108. 'growth.submitted_mobile_prompt_ask_teammate': MobilePromptBannerParams;
  109. 'invite_modal.add_more': InviteModal;
  110. 'invite_modal.closed': InviteModal;
  111. 'invite_modal.invites_sent': InviteModal;
  112. 'invite_modal.opened': InviteModal & {
  113. can_invite: boolean;
  114. source?: string;
  115. };
  116. 'invite_modal.requests_sent': InviteModal;
  117. 'invite_request.approved': InviteRequestParam;
  118. 'invite_request.denied': InviteRequestParam;
  119. 'member_settings_page.loaded': {
  120. num_invite_requests: number;
  121. num_members: number;
  122. };
  123. 'onboarding.wizard_clicked': {
  124. action: string;
  125. todo_id: string;
  126. todo_title: string;
  127. };
  128. 'onboarding.wizard_opened': {};
  129. 'sample_event.button_viewed': {
  130. project_id: string;
  131. source: string;
  132. };
  133. 'sample_event.created': SampleEvent;
  134. 'sample_event.failed': SampleEvent;
  135. 'sdk_updates.clicked': {};
  136. 'sdk_updates.seen': {};
  137. 'sdk_updates.snoozed': {};
  138. };
  139. type GrowthAnalyticsKey = keyof GrowthEventParameters;
  140. export const growthEventMap: Record<GrowthAnalyticsKey, string | null> = {
  141. 'assistant.guide_finished': 'Assistant Guide Finished',
  142. 'assistant.guide_dismissed': 'Assistant Guide Dismissed',
  143. 'growth.clicked_mobile_prompt_setup_project':
  144. 'Growth: Clicked Mobile Prompt Setup Project',
  145. 'growth.clicked_mobile_prompt_ask_teammate':
  146. 'Growth: Clicked Mobile Prompt Ask Teammate',
  147. 'growth.submitted_mobile_prompt_ask_teammate':
  148. 'Growth: Submitted Mobile Prompt Ask Teammate',
  149. 'growth.demo_click_get_started': 'Growth: Demo Click Get Started',
  150. 'growth.demo_click_docs': 'Growth: Demo Click Docs',
  151. 'growth.demo_click_request_demo': 'Growth: Demo Click Request Demo',
  152. 'growth.clicked_sidebar': 'Growth: Clicked Sidebar',
  153. 'growth.onboarding_load_choose_platform':
  154. 'Growth: Onboarding Load Choose Platform Page',
  155. 'growth.onboarding_set_up_your_project': 'Growth: Onboarding Click Set Up Your Project',
  156. 'growth.onboarding_set_up_your_projects':
  157. 'Growth: Onboarding Click Set Up Your Projects',
  158. 'growth.select_platform': 'Growth: Onboarding Choose Platform',
  159. 'growth.platformpicker_category': 'Growth: Onboarding Platform Category',
  160. 'growth.platformpicker_search': 'Growth: Onboarding Platform Search',
  161. 'growth.metric_alert_preset_use_template': 'Growth: Metric Alert Preset Use Template',
  162. 'growth.metric_alert_preset_sidebar_clicked':
  163. 'Growth: Metric Alert Preset Sidebar Clicked',
  164. 'growth.onboarding_start_onboarding': 'Growth: Onboarding Start Onboarding',
  165. 'growth.onboarding_clicked_skip': 'Growth: Onboarding Clicked Skip',
  166. 'growth.onboarding_take_to_error': 'Growth: Onboarding Take to Error',
  167. 'growth.onboarding_view_full_docs': 'Growth: Onboarding View Full Docs',
  168. 'growth.onboarding_view_sample_event': 'Growth: Onboarding View Sample Event',
  169. 'growth.onboarding_clicked_instrument_app': 'Growth: Onboarding Clicked Instrument App',
  170. 'growth.onboarding_clicked_setup_platform_later':
  171. 'Growth: Onboarding Clicked Setup Platform Later',
  172. 'growth.onboarding_quick_start_cta': 'Growth: Quick Start Onboarding CTA',
  173. 'invite_request.approved': 'Invite Request Approved',
  174. 'invite_request.denied': 'Invite Request Denied',
  175. 'growth.demo_modal_clicked_signup': 'Growth: Demo Modal Clicked Signup',
  176. 'growth.demo_modal_clicked_continue': 'Growth: Demo Modal Clicked Continue',
  177. 'growth.demo_modal_clicked_close': 'Growth: Demo Modal Clicked Close',
  178. 'growth.demo_modal_clicked_demo': 'Growth: Demo Modal Clicked Demo',
  179. 'growth.clicked_enter_sandbox': 'Growth: Clicked Enter Sandbox',
  180. 'growth.onboarding_clicked_project_in_sidebar': 'Growth: Clicked Project Sidebar',
  181. 'growth.sample_transaction_docs_link_clicked':
  182. 'Growth: Sample Transaction Docs Link Clicked',
  183. 'growth.sample_error_onboarding_link_clicked':
  184. 'Growth: Sample Error Onboarding Link Clicked',
  185. 'member_settings_page.loaded': 'Member Settings Page Loaded',
  186. 'invite_modal.opened': 'Invite Modal: Opened',
  187. 'invite_modal.closed': 'Invite Modal: Closed',
  188. 'invite_modal.add_more': 'Invite Modal: Add More',
  189. 'invite_modal.invites_sent': 'Invite Modal: Invites Sent',
  190. 'invite_modal.requests_sent': 'Invite Modal: Requests Sent',
  191. 'sdk_updates.seen': 'SDK Updates: Seen',
  192. 'sdk_updates.snoozed': 'SDK Updates: Snoozed',
  193. 'sdk_updates.clicked': 'SDK Updates: Clicked',
  194. 'onboarding.wizard_opened': 'Onboarding Wizard Opened',
  195. 'onboarding.wizard_clicked': 'Onboarding Wizard Clicked',
  196. 'sample_event.button_viewed': null, // high-volume event
  197. 'sample_event.created': 'Sample Event Created',
  198. 'sample_event.failed': 'Sample Event Failed',
  199. 'growth.onboarding_wizard_clicked_more_details':
  200. 'Onboarding Wizard: Clicked More Details',
  201. 'growth.onboarding_wizard_interacted': 'Onboarding Wizard: Interacted',
  202. 'assistant.guide_cued': 'Assistant Guide Cued',
  203. };