integrationAnalyticsEvents.tsx 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. import {StacktraceErrorMessage} from 'sentry/components/events/interfaces/frame/stacktraceLink';
  2. import {IntegrationType, PlatformType, SentryAppStatus} from 'sentry/types';
  3. // define the various event payloads
  4. type View = {
  5. view?:
  6. | 'external_install'
  7. | 'legacy_integrations'
  8. | 'plugin_details'
  9. | 'integrations_directory'
  10. | 'integrations_directory_integration_detail'
  11. | 'stacktrace_issue_details'
  12. | 'integration_configuration_detail'
  13. | 'onboarding'
  14. | 'project_creation';
  15. };
  16. type SingleIntegrationEventParams = {
  17. integration: string; // the slug
  18. integration_type: IntegrationType;
  19. already_installed?: boolean;
  20. // include the status since people might do weird things testing unpublished integrations
  21. integration_status?: SentryAppStatus;
  22. integration_tab?: 'configurations' | 'overview';
  23. plan?: string;
  24. } & View;
  25. type MultipleIntegrationsEventParams = {
  26. integrations_installed: number;
  27. } & View;
  28. type IntegrationSearchEventParams = {
  29. num_results: number;
  30. search_term: string;
  31. } & View;
  32. type IntegrationCategorySelectEventParams = {
  33. category: string;
  34. } & View;
  35. type IntegrationStacktraceLinkEventParams = {
  36. error_reason?: StacktraceErrorMessage;
  37. platform?: PlatformType;
  38. provider?: string;
  39. setup_type?: 'automatic' | 'manual';
  40. } & View;
  41. type IntegrationServerlessFunctionsViewedParams = {
  42. num_functions: number;
  43. } & SingleIntegrationEventParams;
  44. type IntegrationServerlessFunctionActionParams = {
  45. action: 'enable' | 'disable' | 'updateVersion';
  46. } & SingleIntegrationEventParams;
  47. type IntegrationInstallationInputValueChangeEventParams = {
  48. field_name: string;
  49. } & SingleIntegrationEventParams;
  50. type IntegrationCodeOwnersEventParams = {
  51. project_id: string;
  52. } & View;
  53. // define the event key to payload mappings
  54. export type IntegrationEventParameters = {
  55. 'integrations.cloudformation_link_clicked': SingleIntegrationEventParams;
  56. 'integrations.code_mappings_viewed': SingleIntegrationEventParams;
  57. 'integrations.code_owners_cta_docs_clicked': IntegrationCodeOwnersEventParams;
  58. 'integrations.code_owners_cta_setup_clicked': IntegrationCodeOwnersEventParams;
  59. 'integrations.config_saved': SingleIntegrationEventParams;
  60. 'integrations.details_viewed': SingleIntegrationEventParams;
  61. 'integrations.directory_category_selected': IntegrationCategorySelectEventParams;
  62. 'integrations.directory_item_searched': IntegrationSearchEventParams;
  63. 'integrations.disabled': SingleIntegrationEventParams;
  64. 'integrations.dismissed_code_owners_prompt': IntegrationCodeOwnersEventParams;
  65. 'integrations.enabled': SingleIntegrationEventParams;
  66. // for an individual configuration
  67. 'integrations.index_viewed': MultipleIntegrationsEventParams;
  68. 'integrations.install_modal_opened': SingleIntegrationEventParams;
  69. 'integrations.installation_complete': SingleIntegrationEventParams;
  70. 'integrations.installation_input_value_changed': IntegrationInstallationInputValueChangeEventParams;
  71. 'integrations.installation_start': SingleIntegrationEventParams;
  72. 'integrations.integration_tab_clicked': SingleIntegrationEventParams;
  73. 'integrations.integration_viewed': SingleIntegrationEventParams;
  74. 'integrations.plugin_add_to_project_clicked': SingleIntegrationEventParams;
  75. 'integrations.reconfigure_stacktrace_setup': IntegrationStacktraceLinkEventParams;
  76. 'integrations.request_install': SingleIntegrationEventParams;
  77. 'integrations.resolve_now_clicked': SingleIntegrationEventParams;
  78. 'integrations.serverless_function_action': IntegrationServerlessFunctionActionParams;
  79. 'integrations.serverless_functions_viewed': IntegrationServerlessFunctionsViewedParams;
  80. 'integrations.show_code_owners_prompt': IntegrationCodeOwnersEventParams;
  81. 'integrations.stacktrace_complete_setup': IntegrationStacktraceLinkEventParams;
  82. 'integrations.stacktrace_docs_clicked': IntegrationStacktraceLinkEventParams;
  83. 'integrations.stacktrace_link_clicked': IntegrationStacktraceLinkEventParams;
  84. 'integrations.stacktrace_link_cta_dismissed': IntegrationStacktraceLinkEventParams;
  85. 'integrations.stacktrace_manual_option_clicked': IntegrationStacktraceLinkEventParams;
  86. 'integrations.stacktrace_start_setup': IntegrationStacktraceLinkEventParams;
  87. 'integrations.stacktrace_submit_config': IntegrationStacktraceLinkEventParams;
  88. 'integrations.switch_manual_sdk_setup': SingleIntegrationEventParams;
  89. 'integrations.uninstall_clicked': SingleIntegrationEventParams;
  90. 'integrations.uninstall_completed': SingleIntegrationEventParams;
  91. 'integrations.upgrade_plan_modal_opened': SingleIntegrationEventParams;
  92. };
  93. export type IntegrationAnalyticsKey = keyof IntegrationEventParameters;
  94. // define the event key to event name mappings
  95. export const integrationEventMap: Record<IntegrationAnalyticsKey, string> = {
  96. 'integrations.upgrade_plan_modal_opened': 'Integrations: Upgrade Plan Modal Opened',
  97. 'integrations.install_modal_opened': 'Integrations: Install Modal Opened',
  98. 'integrations.integration_viewed': 'Integrations: Integration Viewed',
  99. 'integrations.installation_start': 'Integrations: Installation Start',
  100. 'integrations.installation_complete': 'Integrations: Installation Complete',
  101. 'integrations.uninstall_clicked': 'Integrations: Uninstall Clicked',
  102. 'integrations.uninstall_completed': 'Integrations: Uninstall Completed',
  103. 'integrations.enabled': 'Integrations: Enabled',
  104. 'integrations.disabled': 'Integrations: Disabled',
  105. 'integrations.config_saved': 'Integrations: Config Saved',
  106. 'integrations.integration_tab_clicked': 'Integrations: Integration Tab Clicked',
  107. 'integrations.plugin_add_to_project_clicked':
  108. 'Integrations: Plugin Add to Project Clicked',
  109. 'integrations.resolve_now_clicked': 'Integrations: Resolve Now Clicked',
  110. 'integrations.request_install': 'Integrations: Request Install',
  111. 'integrations.code_mappings_viewed': 'Integrations: Code Mappings Viewed',
  112. 'integrations.details_viewed': 'Integrations: Details Viewed',
  113. 'integrations.index_viewed': 'Integrations: Index Page Viewed',
  114. 'integrations.directory_item_searched': 'Integrations: Directory Item Searched',
  115. 'integrations.directory_category_selected': 'Integrations: Directory Category Selected',
  116. 'integrations.stacktrace_link_cta_dismissed':
  117. 'Integrations: Stacktrace Link CTA Dismissed',
  118. 'integrations.stacktrace_start_setup': 'Integrations: Stacktrace Start Setup',
  119. 'integrations.stacktrace_submit_config': 'Integrations: Stacktrace Submit Config',
  120. 'integrations.stacktrace_complete_setup': 'Integrations: Stacktrace Complete Setup',
  121. 'integrations.stacktrace_manual_option_clicked':
  122. 'Integrations: Stacktrace Manual Option Clicked',
  123. 'integrations.stacktrace_link_clicked': 'Integrations: Stacktrace Link Clicked',
  124. 'integrations.reconfigure_stacktrace_setup':
  125. 'Integrations: Reconfigure Stacktrace Setup',
  126. 'integrations.stacktrace_docs_clicked': 'Integrations: Stacktrace Docs Clicked',
  127. 'integrations.serverless_functions_viewed': 'Integrations: Serverless Functions Viewed',
  128. 'integrations.installation_input_value_changed':
  129. 'Integrations: Installation Input Value Changed',
  130. 'integrations.serverless_function_action': 'Integrations: Serverless Function Action',
  131. 'integrations.cloudformation_link_clicked': 'Integrations: CloudFormation Link Clicked',
  132. 'integrations.switch_manual_sdk_setup': 'Integrations: Switch Manual SDK Setup',
  133. 'integrations.code_owners_cta_setup_clicked':
  134. 'Integrations: Code Owners CTA Setup Clicked',
  135. 'integrations.code_owners_cta_docs_clicked':
  136. 'Integrations: Code Owners CTA Setup Clicked',
  137. 'integrations.show_code_owners_prompt': 'Integrations: Show Code Owners Prompt',
  138. 'integrations.dismissed_code_owners_prompt':
  139. 'Integrations: Dismissed Code Owners Prompt',
  140. };