You can use static-router willTransitionTo static function to detect route changes and emit transition.path in a ga() function call, for example:
var App = React.createClass({ mixins: [Router.State], statics: { willTransitionTo: function(transition, params, query, props) { ga('send', 'pageview', {'page': transition.path}); } }, render: function() { return ( <div> <RouteHandler /> </div> ); } });
A more complete example can be seen in this answer .
pxwise
source share