Add initial support for Google Analytics

This commit is contained in:
Deluan
2020-07-03 12:53:35 -04:00
committed by Deluan Quintão
parent dd91f983b5
commit 1cc03fdd8c
7 changed files with 31 additions and 0 deletions
+10
View File
@@ -1,4 +1,5 @@
import React from 'react'
import ReactGA from 'react-ga'
import { Provider } from 'react-redux'
import { createHashHistory } from 'history'
import { Admin, Resource } from 'react-admin'
@@ -19,9 +20,18 @@ import themeReducer from './personal/themeReducer'
import { addToPlaylistDialogReducer } from './dialogs/dialogState'
import createAdminStore from './store/createAdminStore'
import { i18nProvider } from './i18n'
import config from './config'
const history = createHashHistory()
if (config.gaTrackingId) {
ReactGA.initialize(config.gaTrackingId)
history.listen((location) => {
ReactGA.pageview(location.pathname)
})
ReactGA.pageview(window.location.pathname)
}
const App = () => (
<Provider
store={createAdminStore({