From 3a69336193bff5a2c03f910b42b763c5ba7059c6 Mon Sep 17 00:00:00 2001 From: dom phan Date: Wed, 9 Oct 2024 13:21:05 -0700 Subject: [PATCH] chore: Add analytics to track projection config and expressions --- .../src/components/Panel2/PanelExpression/Component.tsx | 7 ++++++- .../Panel2/PanelProjectionConverter/component.tsx | 4 ++++ weave-js/src/components/Panel2/PanelTable/ColumnHeader.tsx | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/weave-js/src/components/Panel2/PanelExpression/Component.tsx b/weave-js/src/components/Panel2/PanelExpression/Component.tsx index 0454c4b83fc..556420ee610 100644 --- a/weave-js/src/components/Panel2/PanelExpression/Component.tsx +++ b/weave-js/src/components/Panel2/PanelExpression/Component.tsx @@ -88,7 +88,12 @@ const PanelExpression: React.FC = props => { { + updateExp(expr); + recordEvent('SET_EXP', { + exprString: weave.expToString(expr), + }); + }} noBox onMount={onMount} /> diff --git a/weave-js/src/components/Panel2/PanelProjectionConverter/component.tsx b/weave-js/src/components/Panel2/PanelProjectionConverter/component.tsx index 06514ef802e..9db0c635d56 100644 --- a/weave-js/src/components/Panel2/PanelProjectionConverter/component.tsx +++ b/weave-js/src/components/Panel2/PanelProjectionConverter/component.tsx @@ -4,6 +4,7 @@ import React, {useCallback, useMemo} from 'react'; import {useNodeWithServerType} from '../../../react'; import * as ConfigPanel from '../ConfigPanel'; import * as Panel2 from '../panel'; +import {makeEventRecorder} from '../panellib/libanalytics'; import * as TableType from '../PanelTable/tableType'; import * as PTypes from './types'; import * as PUtil from './util'; @@ -13,6 +14,8 @@ type PanelProjectionConverterProps = Panel2.PanelProps< PTypes.PanelProjectionConverterConfigType >; +const recordEvent = makeEventRecorder('Projection'); + const MIN_ITER = 500; const ALGO_OPTIONS = [ @@ -150,6 +153,7 @@ const PanelProjectionConverterConfigInner: React.FC< } }); updateConfig(rootUpdate); + recordEvent('UPDATE_CONFIG', rootUpdate); }; }, [config, updateConfig] diff --git a/weave-js/src/components/Panel2/PanelTable/ColumnHeader.tsx b/weave-js/src/components/Panel2/PanelTable/ColumnHeader.tsx index 2cec0539611..5b4ac95aaae 100644 --- a/weave-js/src/components/Panel2/PanelTable/ColumnHeader.tsx +++ b/weave-js/src/components/Panel2/PanelTable/ColumnHeader.tsx @@ -204,7 +204,9 @@ export const ColumnHeader: React.FC<{ } if (panelUpdated) { - recordEvent('UPDATE_COLUMN_PANEL'); + recordEvent('UPDATE_COLUMN_PANEL', { + exprString: weave.expToString(workingSelectFunction), + }); } }