mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	feat: hours back feature metrics tracking (#5904)
This commit is contained in:
		
							parent
							
								
									3b5b1ec020
								
							
						
					
					
						commit
						dfeaea8ee9
					
				| @ -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'); | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user