Add Telemetry (#466)
* Telemetry v1 * Add package-lock.json to gitignore
This commit is contained in:
17
front/src/modules/analytics/hooks/useTrackPageView.ts
Normal file
17
front/src/modules/analytics/hooks/useTrackPageView.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
import { useEventTracker } from './useEventTracker';
|
||||
|
||||
export function useTrackPageView() {
|
||||
const location = useLocation();
|
||||
const eventTracker = useEventTracker();
|
||||
|
||||
useEffect(() => {
|
||||
eventTracker('pageview', {
|
||||
location: {
|
||||
pathname: location.pathname,
|
||||
},
|
||||
});
|
||||
}, [location, eventTracker]);
|
||||
}
|
||||
Reference in New Issue
Block a user