title: React Router: logging every access to a specific route
body: <p>In React, I have code like this:</p>
  
  <pre><code>&lt;Router basename='/app'&gt;
    &lt;main&gt;
      &lt;Menu active={menu} close={this.closeMenu} /&gt;
      &lt;Overlay active={menu} onClick={this.closeMenu} /&gt;
      &lt;AppBar handleMenuIcon={this.handleMenuIcon} title='Test' /&gt;
      &lt;Route path='/customers/:id' component={Customers} /&gt;
      &lt;Route path='/products/:id' component={Products} /&gt;
    &lt;/main&gt;
  &lt;/Router&gt;
  </code></pre>
  
  <p>Every time <code>/customers/:id</code> or <code>/products/:id</code> is accessed, I want to log the access by making an ajax call to a backend service. The fields I will be logging include the referrer URL, the current URL, and a randomly generated session ID (random base 64 integer)  What's the best way to do that when I am using the <code>Router</code> component from <a href="https://github.com/ReactTraining/react-router" rel="nofollow noreferrer"><code>react-router</code></a> version 1.0.0.</p>