✨ feat(App): add page tracking
This commit is contained in:
@@ -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
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user