Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
rvennam987 committed Feb 15, 2017
1 parent f72e0cd commit 6f7b94c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -125,6 +125,7 @@
"react-container-query": "^0.5.4",
"react-dom": "^15.3.0",
"react-fa": "^4.1.2",
"react-ga": "^2.1.2",
"react-redux": "^4.0.0",
"react-router": "^2.6.1",
"react-router-redux": "^4.0.0",
Expand Down
9 changes: 8 additions & 1 deletion src/containers/AppContainer.jsx
@@ -1,17 +1,24 @@
import React, { PropTypes } from 'react';
import ReactGA from 'react-ga';
import { Router } from 'react-router';
import { Provider } from 'react-redux';
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
import muiTheme from 'styles/muiTheme';

ReactGA.initialize('UA-92026109-1'); // Unique Google Analytics tracking number

const AppContainer = (props) => {
const { history, routes, store } = props;

function logPageView() {
ReactGA.set({ page: window.location.pathname });
ReactGA.pageview(window.location.pathname);
}
return (
<Provider store={store}>
<MuiThemeProvider muiTheme={muiTheme}>
<div style={{ display: 'flex', flexGrow: 1, flexDirection: 'column' }}>
<Router history={history} children={routes} />
<Router history={history} children={routes} onUpdate={logPageView} />
</div>
</MuiThemeProvider>
</Provider>
Expand Down

0 comments on commit 6f7b94c

Please sign in to comment.