✨ feat(App): add page tracking

This commit is contained in:
2025-05-28 10:29:48 +00:00
parent bf6d945c61
commit e0f90d5d87
6 changed files with 77 additions and 41 deletions
+1 -1
View File
@@ -100,7 +100,7 @@ const CustomToolbar: React.FC<CustomToolbarProps> = ({ drawerWidth = 240, window
sx={{
display: 'flex',
// maxWidth: '100%',
// [theme.breakpoints.up('md')]: { width: '80em', mx: 'auto' },
// [theme.breakpoints.up('md')]: { width: theme => theme.breakpoints.values.lg, mx: 'auto' },
}}>
<IconButton
color="primary"
@@ -0,0 +1,19 @@
import { useEffect } from 'react'
import { useAnalytics } from 'use-analytics'
import { Outlet, useLocation } from 'react-router-dom'
/**
* Route tracking component that wraps all routes and includes analytics page tracking
*/
const RouteTracker = () => {
const location = useLocation()
const analytics = useAnalytics()
useEffect(() => {
analytics.page()
}, [analytics, location])
return <Outlet />
}
export default RouteTracker
+2 -1
View File
@@ -1 +1,2 @@
export { default as Page } from './Page'
export { default as Page } from './Page/index.js'
export { default as RouteTracker } from './RouteTracker/index.js'