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.

First create your tracking ID from Google Analytics by going to https://analytics.google.com/ A howto guide is available here.

Then in the parent component of your React.js app

  1. Install the react-ga module: npm install --save react-ga
  2. Import this module at the top of the app: import ReactGA from 'react-ga';
  3. 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!