From 6f7b94c4baf11fb916ceb54cb8b83c79bdd2c15d Mon Sep 17 00:00:00 2001 From: Ram Vennam Date: Tue, 14 Feb 2017 22:33:18 -0600 Subject: [PATCH] google analytics --- package.json | 1 + src/containers/AppContainer.jsx | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 18ef238..bcd2af1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/containers/AppContainer.jsx b/src/containers/AppContainer.jsx index b7b93a3..e21587d 100644 --- a/src/containers/AppContainer.jsx +++ b/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 (
- +