in React JS by
Q:

How to add Google Analytics for React Router?

1 Answer

0 votes
by

Add a listener on the history object to record each page view:

history.listen(function (location) {
  window.ga('set', 'page', location.pathname + location.search)
  window.ga('send', 'pageview', location.pathname + location.search)
})
Click here to read more about React JS
Click here to read more about Insurance

Related questions

+1 vote
asked Mar 2, 2020 in React JS by RShastri
0 votes
asked Mar 2, 2020 in React JS by RShastri
0 votes
asked Sep 15, 2020 in Google Adsense by Hodge
0 votes
asked Sep 15, 2020 in Google Adsense by Hodge
0 votes
asked May 21, 2020 in React JS by GeorgeBell
...