How to set up Google Analytics for React-Router?
<p>I'm trying set up Google Analytics on my react site, and have come across a few packages, but none of which has the kind of set up that I have in terms of examples.  Was hoping someone could shed some light on this.  </p>

<p>The package I'm looking at is, <a href="https://www.npmjs.com/package/react-ga" rel="noreferrer">react-ga</a>.</p>

<p>My render method on my <code>index.js</code> looks like this.</p>

<pre><code>React.render((
&lt;Router history={createBrowserHistory()}&gt;
    &lt;Route path="/" component={App}&gt;
        &lt;IndexRoute component={Home} onLeave={closeHeader}/&gt;
        &lt;Route path="/about" component={About} onLeave={closeHeader}/&gt;
        &lt;Route path="/gallery" component={Gallery} onLeave={closeHeader}/&gt;
        &lt;Route path="/contact-us" component={Contact} onLeave={closeHeader}&gt;
            &lt;Route path="/contact-us/:service" component={Contact} onLeave={closeHeader}/&gt;
        &lt;/Route&gt;
        &lt;Route path="/privacy-policy" component={PrivacyPolicy} onLeave={closeHeader} /&gt;
        &lt;Route path="/feedback" component={Feedback} onLeave={closeHeader} /&gt;
    &lt;/Route&gt;
    &lt;Route path="*" component={NoMatch} onLeave={closeHeader}/&gt;
&lt;/Router&gt;), document.getElementById('root'));
</code></pre>