If you have a single page app that has no routes, getting visitors tracked with Google Analytics is pretty straight forward using the React Google Analytics Module.
Then in the parent component of your React.js app
- Install the react-ga module:
npm install --save react-ga
- Import this module at the top of the app:
import ReactGA from 'react-ga';
- And add the 2 lines of code into your constructor as shown below on lines 12 and 14.
I had data being tracked within 24 hours from adding this module.
If you are using react-router, there is a little more config as outlined here.
Any questions, let me know!