mirror of
https://github.com/Unleash/unleash.git
synced 2025-08-04 13:48:56 +02:00
feat: start tracking project tab navigation
This commit is contained in:
parent
bd4402302c
commit
ff6ca920ce
@ -44,6 +44,7 @@ import { ProjectApplications } from '../ProjectApplications/ProjectApplications'
|
|||||||
import { ProjectInsights } from './ProjectInsights/ProjectInsights';
|
import { ProjectInsights } from './ProjectInsights/ProjectInsights';
|
||||||
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview';
|
||||||
import { ProjectArchived } from './ArchiveProject/ProjectArchived';
|
import { ProjectArchived } from './ArchiveProject/ProjectArchived';
|
||||||
|
import { usePlausibleTracker } from '../../../hooks/usePlausibleTracker';
|
||||||
|
|
||||||
const StyledBadge = styled(Badge)(({ theme }) => ({
|
const StyledBadge = styled(Badge)(({ theme }) => ({
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
@ -65,6 +66,7 @@ interface ITab {
|
|||||||
|
|
||||||
export const Project = () => {
|
export const Project = () => {
|
||||||
const projectId = useRequiredPathParam('projectId');
|
const projectId = useRequiredPathParam('projectId');
|
||||||
|
const { trackEvent } = usePlausibleTracker();
|
||||||
const params = useQueryParams();
|
const params = useQueryParams();
|
||||||
const { project, loading, error, refetch } = useProjectOverview(projectId);
|
const { project, loading, error, refetch } = useProjectOverview(projectId);
|
||||||
const ref = useLoading(loading, '[data-loading-project=true]');
|
const ref = useLoading(loading, '[data-loading-project=true]');
|
||||||
@ -252,7 +254,16 @@ export const Project = () => {
|
|||||||
key={tab.title}
|
key={tab.title}
|
||||||
label={tab.title}
|
label={tab.title}
|
||||||
value={tab.path}
|
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}`}
|
data-testid={`TAB_${tab.title}`}
|
||||||
iconPosition={
|
iconPosition={
|
||||||
tab.isEnterprise ? 'end' : undefined
|
tab.isEnterprise ? 'end' : undefined
|
||||||
|
@ -71,7 +71,8 @@ export type CustomEvents =
|
|||||||
| 'onboarding'
|
| 'onboarding'
|
||||||
| 'personal-dashboard'
|
| 'personal-dashboard'
|
||||||
| 'order-environments'
|
| 'order-environments'
|
||||||
| 'unleash-ai-chat';
|
| 'unleash-ai-chat'
|
||||||
|
| 'project-navigation';
|
||||||
|
|
||||||
export const usePlausibleTracker = () => {
|
export const usePlausibleTracker = () => {
|
||||||
const plausible = useContext(PlausibleContext);
|
const plausible = useContext(PlausibleContext);
|
||||||
|
Loading…
Reference in New Issue
Block a user