0

I put in the initialization code, but it only runs once for one page. How do I get the google tracker to fire for multiple pages in the app?

In App.js

 ReactGA.initialize("UA-XXXXXXXXX-1");
 let baseUrl = window.location.pathname;
 ReactGA.pageview(baseUrl); 
M B
  • 11
  • 3

1 Answers1

0

I recommand 2 different options:

  1. Add the google tracker in the navigation bar (or footer). It will renders in every page.
  2. Create a custom component and put on every rendered page.
Rotem
  • 1,381
  • 1
  • 11
  • 23