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:
parent
331033408c
commit
e4ca8a3e6c
@ -1,5 +1,5 @@
|
|||||||
import { render } from 'utils/testRenderer';
|
import { render } from 'utils/testRenderer';
|
||||||
import { screen, within } from '@testing-library/react';
|
import { screen } from '@testing-library/react';
|
||||||
import { StrategyDiff } from './StrategyTooltipLink';
|
import { StrategyDiff } from './StrategyTooltipLink';
|
||||||
import { IFeatureStrategy } from 'interfaces/strategy';
|
import { IFeatureStrategy } from 'interfaces/strategy';
|
||||||
import { IChangeRequestUpdateStrategy } from 'component/changeRequest/changeRequest.types';
|
import { IChangeRequestUpdateStrategy } from 'component/changeRequest/changeRequest.types';
|
||||||
|
@ -286,7 +286,15 @@ const FeatureToggleListTableComponent: VFC = () => {
|
|||||||
}
|
}
|
||||||
}, [isSmallScreen, isMediumScreen]);
|
}, [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;
|
const rows = table.getRowModel().rows;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import { getCreateTogglePath } from 'utils/routePathHelpers';
|
|||||||
import { CREATE_FEATURE } from 'component/providers/AccessProvider/permissions';
|
import { CREATE_FEATURE } from 'component/providers/AccessProvider/permissions';
|
||||||
import { ExportDialog } from 'component/feature/FeatureToggleList/ExportDialog';
|
import { ExportDialog } from 'component/feature/FeatureToggleList/ExportDialog';
|
||||||
import { FeatureSchema } from 'openapi';
|
import { FeatureSchema } from 'openapi';
|
||||||
|
import { usePlausibleTracker } from 'hooks/usePlausibleTracker';
|
||||||
|
|
||||||
interface IProjectFeatureTogglesHeaderProps {
|
interface IProjectFeatureTogglesHeaderProps {
|
||||||
isLoading?: boolean;
|
isLoading?: boolean;
|
||||||
@ -53,8 +54,15 @@ export const ProjectFeatureTogglesHeader: VFC<
|
|||||||
const featuresExportImportFlag = useUiFlag('featuresExportImport');
|
const featuresExportImportFlag = useUiFlag('featuresExportImport');
|
||||||
const [showExportDialog, setShowExportDialog] = useState(false);
|
const [showExportDialog, setShowExportDialog] = useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { trackEvent } = usePlausibleTracker();
|
||||||
const handleSearch = (query: string) => {
|
const handleSearch = (query: string) => {
|
||||||
onChangeSearchQuery?.(query);
|
onChangeSearchQuery?.(query);
|
||||||
|
trackEvent('search-bar', {
|
||||||
|
props: {
|
||||||
|
screen: 'project',
|
||||||
|
length: query.length,
|
||||||
|
},
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -56,7 +56,8 @@ export type CustomEvents =
|
|||||||
| 'search-feature-buttons'
|
| 'search-feature-buttons'
|
||||||
| 'new-strategy-form'
|
| 'new-strategy-form'
|
||||||
| 'feedback'
|
| 'feedback'
|
||||||
| 'feature-metrics';
|
| 'feature-metrics'
|
||||||
|
| 'search-bar';
|
||||||
|
|
||||||
export const usePlausibleTracker = () => {
|
export const usePlausibleTracker = () => {
|
||||||
const plausible = useContext(PlausibleContext);
|
const plausible = useContext(PlausibleContext);
|
||||||
|
Loading…
Reference in New Issue
Block a user