diff --git a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.tsx b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.tsx index 229bf65d81..19ac4fc9ea 100644 --- a/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.tsx +++ b/frontend/src/component/feature/FeatureView/FeatureMetrics/FeatureMetricsHours/FeatureMetricsHours.tsx @@ -5,6 +5,7 @@ import GeneralSelect, { import { subWeeks, subMonths, differenceInHours } from 'date-fns'; import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; import { useUiFlag } from 'hooks/useUiFlag'; +import { usePlausibleTracker } from 'hooks/usePlausibleTracker'; const StyledTitle = styled('h2')(({ theme }) => ({ margin: 0, @@ -25,8 +26,15 @@ export const FeatureMetricsHours = ({ hoursBack, setHoursBack, }: IFeatureMetricsHoursProps) => { + const { trackEvent } = usePlausibleTracker(); const onChange: IGeneralSelectProps['onChange'] = (key) => { setHoursBack(parseInt(key)); + trackEvent('feature-metrics', { + props: { + eventType: 'change-period', + hoursBack: key, + }, + }); }; const { isEnterprise } = useUiConfig(); const extendedUsageMetrics = useUiFlag('extendedUsageMetricsUI'); diff --git a/frontend/src/hooks/usePlausibleTracker.ts b/frontend/src/hooks/usePlausibleTracker.ts index 23a209b2d8..2752ccbb39 100644 --- a/frontend/src/hooks/usePlausibleTracker.ts +++ b/frontend/src/hooks/usePlausibleTracker.ts @@ -55,7 +55,8 @@ export type CustomEvents = | 'scheduled-configuration-changes' | 'search-feature-buttons' | 'new-strategy-form' - | 'feedback'; + | 'feedback' + | 'feature-metrics'; export const usePlausibleTracker = () => { const plausible = useContext(PlausibleContext);