1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00

feat: track search bar events (#6021)

Adding tracking for 2 views, when users use the new search. 

For features view and project view.
This commit is contained in:
Jaanus Sellin 2024-01-24 14:23:23 +02:00 committed by GitHub
parent 331033408c
commit e4ca8a3e6c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 3 deletions

View File

@ -1,5 +1,5 @@
import { render } from 'utils/testRenderer';
import { screen, within } from '@testing-library/react';
import { screen } from '@testing-library/react';
import { StrategyDiff } from './StrategyTooltipLink';
import { IFeatureStrategy } from 'interfaces/strategy';
import { IChangeRequestUpdateStrategy } from 'component/changeRequest/changeRequest.types';

View File

@ -286,7 +286,15 @@ const FeatureToggleListTableComponent: VFC = () => {
}
}, [isSmallScreen, isMediumScreen]);
const setSearchValue = (query = '') => setTableState({ query });
const setSearchValue = (query = '') => {
setTableState({ query });
trackEvent('search-bar', {
props: {
screen: 'features',
length: query.length,
},
});
};
const rows = table.getRowModel().rows;

View File

@ -20,6 +20,7 @@ import { getCreateTogglePath } from 'utils/routePathHelpers';
import { CREATE_FEATURE } from 'component/providers/AccessProvider/permissions';
import { ExportDialog } from 'component/feature/FeatureToggleList/ExportDialog';
import { FeatureSchema } from 'openapi';
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
interface IProjectFeatureTogglesHeaderProps {
isLoading?: boolean;
@ -53,8 +54,15 @@ export const ProjectFeatureTogglesHeader: VFC<
const featuresExportImportFlag = useUiFlag('featuresExportImport');
const [showExportDialog, setShowExportDialog] = useState(false);
const navigate = useNavigate();
const { trackEvent } = usePlausibleTracker();
const handleSearch = (query: string) => {
onChangeSearchQuery?.(query);
trackEvent('search-bar', {
props: {
screen: 'project',
length: query.length,
},
});
};
return (

View File

@ -56,7 +56,8 @@ export type CustomEvents =
| 'search-feature-buttons'
| 'new-strategy-form'
| 'feedback'
| 'feature-metrics';
| 'feature-metrics'
| 'search-bar';
export const usePlausibleTracker = () => {
const plausible = useContext(PlausibleContext);