Merge pull request #28392 from overleaf/dp-segment-editor-analytics

Add editor-redesign segmentation to a bunch of analytics events

GitOrigin-RevId: e8d2091028dab09de06362c38c5a17f32253e7cc
This commit is contained in:
David
2025-09-11 08:05:05 +00:00
committed by Copybot
parent c6df7575d2
commit ae9d84c279
9 changed files with 58 additions and 29 deletions
@@ -7,14 +7,23 @@ import {
} from '@/infrastructure/event-tracking'
import { useCallback } from 'react'
export function populateEditorRedesignSegmentation<
SegmentationType extends Segmentation,
>(
segmentation: SegmentationType | undefined = {} as SegmentationType,
editorRedesign: boolean
): SegmentationType & { 'editor-redesign'?: 'enabled' } {
return editorRedesign
? { ...segmentation, 'editor-redesign': 'enabled' }
: segmentation
}
export const useEditorAnalytics = () => {
const editorRedesign = useIsNewEditorEnabled()
const populateSegmentation = useCallback(
(segmentation: Segmentation | undefined = {}): Segmentation => {
return editorRedesign
? { ...segmentation, 'editor-redesign': 'enabled' }
: segmentation
return populateEditorRedesignSegmentation(segmentation, editorRedesign)
},
[editorRedesign]
)