diff --git a/client/src/components/App.js b/client/src/components/App.js index 47c3fcd..7525c66 100644 --- a/client/src/components/App.js +++ b/client/src/components/App.js @@ -3,6 +3,7 @@ import {BrowserRouter, Route} from 'react-router-dom'; import {connect} from 'react-redux'; import * as actions from '../actions'; import ReactGA from 'react-ga'; +import createHistory from 'history/createBrowserHistory'; import Header from './Header'; import Hero from './Hero'; @@ -12,11 +13,14 @@ import SimilarList from './SimilarList'; import PopularList from './PopularList'; import PlexTokenForm from './plex/PlexTokenForm'; +const history = createHistory(); ReactGA.initialize('UA-138294820-1'); - +history.listen((location, action) => { + ReactGA.pageview(location.pathname + location.search); + console.log(location.pathname); +}); class App extends Component { componentDidMount() { - ReactGA.pageview(window.location.pathname + window.location.search); this.props.fetchUser(); }