Skip to content
Snippets Groups Projects
Commit b5b8195c authored by esikkala's avatar esikkala
Browse files

Fix usePageViews

parent edb6de5d
No related branches found
No related tags found
No related merge requests found
...@@ -314,8 +314,10 @@ export const usePageViews = () => { ...@@ -314,8 +314,10 @@ export const usePageViews = () => {
const location = useLocation() const location = useLocation()
useEffect(() => { useEffect(() => {
if (typeof window.ga === 'function') { if (typeof window.ga === 'function') {
console.log(window.ga) // https://developers.google.com/analytics/devguides/collection/analyticsjs/single-page-applications#tracking_virtual_pageviews
window.ga.send(['pageview', location.pathname]) // note: the ga function has been initialized in index.html
window.ga('set', 'page', location.pathname)
window.ga('send', 'pageview')
} }
}, [location]) }, [location])
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment