import{trackPage,trackUser,trackEvent}from'react-with-analytics';// you can use these anywhere in your apptrackPage('/home');trackUser('@username');trackEvent('Editing','Deleted Component','Game Widget');// category, action, label
importReactfrom'react';import{BrowserRouter,Link,Route,Switch,withRouter}from'react-router-dom';importwithAnalytics,{initAnalytics}from'react-with-analytics';initAnalytics('UA-00000000-0');constHome=()=>(<div>
HOME <Linkto="/about">ABOUT</Link></div>);constAbout=()=>(<div>
ABOUT <Linkto="/">HOME</Link></div>);constRoot=()=>(<Switch><Routeexactpath="/"component={Home}/><Routepath="/about"component={About}/></Switch>);// you should only use `withAnalytics` once to warp your whole appconstApp=withRouter(withAnalytics(Root));constAppWithRouter=()=>(<BrowserRouter><App/></BrowserRouter>);exportdefaultAppWithRouter;
importReactfrom'react';importRouter,{Link}from'pagify-it';import{initAnalytics,trackPage}from'react-with-analytics';initAnalytics('UA-00000000-0');constHome=()=>(<div>
HOME <Linkto="/about">ABOUT</Link></div>);constAbout=()=>(<div>
ABOUT <Linkto="/">HOME</Link></div>);constroutes={'/': Home,'/about': About};constApp=()=><Router{...{ routes }}onChange={path=>trackPage(path)}/>;exportdefaultApp;