Last active
October 18, 2016 09:16
-
-
Save liesislukas/6e63a13aaa586bb7aeb323d71d8b140c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ReactGA = require('react-ga'); | |
ReactGA.initialize('UA-00000000000-1'); | |
const _route_change_handler = (location) => { | |
ReactGA.set({page: location.pathname}); | |
ReactGA.pageview(location.pathname); | |
}; | |
export default ( | |
<Route | |
component={ AppContainer } | |
onChange={(prevState, nextState, replace) => { | |
_route_change_handler(nextState.location); | |
return true; | |
}} | |
onEnter={(nextState) => { | |
_route_change_handler(nextState.location); | |
return true; | |
}} | |
> | |
<Route path='*' component={ PageContainer }/> | |
</Route> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment