Files
overleaf-cep/services/web/frontend/js/features/source-editor/utils/context-menu-analytics.ts
Malik Glossop a293474c0c Merge pull request #31035 from overleaf/mg-context-menu-analytics
Add analytics event for context menu, comment, track changes, and jump to location

GitOrigin-RevId: 8412cc3c8039cd1582ccee20b162b4bef4467dea
2026-03-06 09:14:26 +00:00

45 lines
962 B
TypeScript

import { sendMB } from '@/infrastructure/event-tracking'
export type ContextMenuItemSegmentation =
| 'cut'
| 'copy'
| 'paste'
| 'paste-without-formatting'
| 'paste-with-formatting'
| 'give-feedback'
| 'delete'
| 'jump-to-location-in-pdf'
| 'suggest-edits'
| 'back-to-editing'
| 'comment'
export type ContextMenuAnalyticsEvents = {
'menu-expand': {
location: 'editor-context-menu'
}
'menu-click': {
location: 'editor-context-menu'
item: ContextMenuItemSegmentation
}
'jump-to-location': {
method: 'editor-context-menu'
direction: 'code-location-in-pdf'
}
'add-comment': {
location: 'editor-context-menu'
}
'paywall-prompt': {
'paywall-type': 'track-changes'
location: 'editor-context-menu'
}
}
export const sendContextMenuEvent = <
T extends keyof ContextMenuAnalyticsEvents,
>(
eventName: T,
segmentation: ContextMenuAnalyticsEvents[T]
) => {
sendMB(eventName, segmentation)
}