growthAnalyticsEvents.tsx 8.0 KB

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