From 987b3a1f71bbbaf5268d52dffe40c70d2ce5df74 Mon Sep 17 00:00:00 2001 From: Domagoj Kriskovic Date: Mon, 25 May 2026 11:23:22 +0200 Subject: [PATCH] Track script-runner-opened analytics event GitOrigin-RevId: fb95aa2f5ad649061a6b8e9797789024a3345f3b --- .../editor/python/python-output-pane.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/services/web/frontend/js/features/ide-react/components/editor/python/python-output-pane.tsx b/services/web/frontend/js/features/ide-react/components/editor/python/python-output-pane.tsx index c54440d047..156e8f613c 100644 --- a/services/web/frontend/js/features/ide-react/components/editor/python/python-output-pane.tsx +++ b/services/web/frontend/js/features/ide-react/components/editor/python/python-output-pane.tsx @@ -1,10 +1,11 @@ -import { useMemo, useSyncExternalStore } from 'react' +import { useEffect, useMemo, useSyncExternalStore } from 'react' import { useTranslation } from 'react-i18next' import classNames from 'classnames' import OLButton from '@/shared/components/ol/ol-button' import OLButtonToolbar from '@/shared/components/ol/ol-button-toolbar' import MaterialIcon from '@/shared/components/material-icon' import SplitTestBadge from '@/shared/components/split-test-badge' +import { sendMB } from '@/infrastructure/event-tracking' import { useEditorOpenDocContext } from '@/features/ide-react/context/editor-open-doc-context' import { usePythonExecutionContext } from '@/features/ide-react/context/python-execution-context' import { DEFAULT_STATE } from './python-runner' @@ -14,13 +15,24 @@ const getDefaultState = () => DEFAULT_STATE export default function PythonOutputPane() { const { t } = useTranslation() - const { currentDocumentId } = useEditorOpenDocContext() + const { currentDocumentId, openDocName } = useEditorOpenDocContext() const { getPythonRunner } = usePythonExecutionContext() const pythonRunner = useMemo( () => (currentDocumentId ? getPythonRunner(currentDocumentId) : null), [currentDocumentId, getPythonRunner] ) + useEffect(() => { + if (!currentDocumentId || !openDocName) { + return + } + sendMB('script-runner-opened', { + fileName: openDocName, + fileExtension: 'py', + editorMode: 'code', + }) + }, [currentDocumentId, openDocName]) + const { output, error, status } = useSyncExternalStore( pythonRunner ? pythonRunner.subscribe : emptySubscribe, pythonRunner ? pythonRunner.getState : getDefaultState