diff --git a/src/hooks/useGoogleAnalytics.js b/src/hooks/useGoogleAnalytics.js index 3e50ba68..3203f3b5 100644 --- a/src/hooks/useGoogleAnalytics.js +++ b/src/hooks/useGoogleAnalytics.js @@ -6,15 +6,20 @@ const GA_MEASUREMENT_ID = "G-2M2VYEFL7B"; const useGoogleAnalytics = () => { const location = useLocation(); - useEffect(() => { - if (typeof window.gtag === 'function') { - const fullPath = location.pathname + location.search + location.hash; - window.gtag('config', GA_MEASUREMENT_ID, { - 'page_path': fullPath, - }); - window.gtag('event', 'page_view', {'page_path': fullPath}); - } - }, [location]); +useEffect(() => { + if (typeof window.gtag === 'function') { + const fullPath = location.pathname + location.search + location.hash; + window.gtag('config', GA_MEASUREMENT_ID, { + 'page_path': fullPath, + }); + window.gtag('event', 'page_view', { + 'page_path': fullPath, + 'page_location': window.location.href + }); + + } +}, [location]); + }; -export default useGoogleAnalytics; +export default useGoogleAnalytics;pat