react-with-analytics
Install
yarn add react-ga react-with-analytics
Usage
Initialize
; ;
Track pages, users and events
; // you can use these anywhere in your app;;; // category, action, label
react-router
With; ; ; ; const Home = <div> HOME <Link to="/about">ABOUT</Link> </div>; const About = <div> ABOUT <Link to="/">HOME</Link> </div>; const Root = <Switch> <Route exact path="/" component=Home /> <Route path="/about" component=About /> </Switch>; // you should only use `withAnalytics` once to warp your whole appconst App = ; const AppWithRouter = <BrowserRouter> <App /> </BrowserRouter>; ;
pagify-it
With; ; ; ; const Home = <div> HOME <Link to="/about">ABOUT</Link> </div>; const About = <div> ABOUT <Link to="/">HOME</Link> </div>; const routes = '/': Home '/about': About; const App = <Router ... routes onChange= />; ;