mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
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
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user