1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-04-15 01:16:22 +02:00

feat: start tracking project tab navigation

This commit is contained in:
sjaanus 2024-10-25 09:16:52 +03:00
parent bd4402302c
commit ff6ca920ce
No known key found for this signature in database
GPG Key ID: 20E007C0248BA7FF
2 changed files with 14 additions and 2 deletions

View File

@ -44,6 +44,7 @@ import { ProjectApplications } from '../ProjectApplications/ProjectApplications'
import { ProjectInsights } from './ProjectInsights/ProjectInsights';
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
import { ProjectArchived } from './ArchiveProject/ProjectArchived';
import { usePlausibleTracker } from '../../../hooks/usePlausibleTracker';
const StyledBadge = styled(Badge)(({ theme }) => ({
position: 'absolute',
@ -65,6 +66,7 @@ interface ITab {
export const Project = () => {
const projectId = useRequiredPathParam('projectId');
const { trackEvent } = usePlausibleTracker();
const params = useQueryParams();
const { project, loading, error, refetch } = useProjectOverview(projectId);
const ref = useLoading(loading, '[data-loading-project=true]');
@ -252,7 +254,16 @@ export const Project = () => {
key={tab.title}
label={tab.title}
value={tab.path}
onClick={() => navigate(tab.path)}
onClick={() => {
if (tab.title !== 'Flags') {
trackEvent('project-navigation', {
props: {
eventType: tab.title,
},
});
}
navigate(tab.path);
}}
data-testid={`TAB_${tab.title}`}
iconPosition={
tab.isEnterprise ? 'end' : undefined

View File

@ -71,7 +71,8 @@ export type CustomEvents =
| 'onboarding'
| 'personal-dashboard'
| 'order-environments'
| 'unleash-ai-chat';
| 'unleash-ai-chat'
| 'project-navigation';
export const usePlausibleTracker = () => {
const plausible = useContext(PlausibleContext);