Jelajahi Sumber

Record when the word count modal is opened (#29134)

GitOrigin-RevId: d49778199e793297c49447f56060dedb31750c34
Alf Eaton 9 bulan lalu
induk
melakukan
ad3d68ece0

+ 11 - 0
services/web/frontend/js/features/word-count-modal/components/word-count-modal-content.tsx

@@ -10,6 +10,8 @@ import { WordCountServer } from './word-count-server'
 import { WordCountClient } from './word-count-client'
 import { isSplitTestEnabled } from '@/utils/splitTestUtils'
 import SplitTestBadge from '@/shared/components/split-test-badge'
+import { useEffect } from 'react'
+import { useEditorAnalytics } from '@/shared/hooks/use-editor-analytics'
 
 // NOTE: this component is only mounted when the modal is open
 export default function WordCountModalContent({
@@ -19,6 +21,15 @@ export default function WordCountModalContent({
 }) {
   const { t } = useTranslation()
 
+  const { sendEvent } = useEditorAnalytics()
+
+  useEffect(() => {
+    // record when the word count modal is opened
+    sendEvent('word-count-opened', {
+      mode: isSplitTestEnabled('word-count-client') ? 'client' : 'server',
+    })
+  }, [sendEvent])
+
   return (
     <>
       <OLModalHeader>