Add initial support for Google Analytics
This commit is contained in:
Generated
+5
@@ -13621,6 +13621,11 @@
|
||||
"@babel/runtime": "^7.4.5"
|
||||
}
|
||||
},
|
||||
"react-ga": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/react-ga/-/react-ga-3.0.0.tgz",
|
||||
"integrity": "sha512-IKqqCtSMe0IfSRNvbHAiwXwIXbuza4VvHvB/2N3hEiMFGSjv8fNI6obPH6bkDdIjDpwzbUqKs8895OxBckWJ2g=="
|
||||
},
|
||||
"react-icon-base": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/react-icon-base/-/react-icon-base-2.1.0.tgz",
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"react-admin": "^3.6.1",
|
||||
"react-dom": "^16.13.1",
|
||||
"react-drag-listview": "^0.1.7",
|
||||
"react-ga": "^3.0.0",
|
||||
"react-jinke-music-player": "^4.13.1",
|
||||
"react-measure": "^2.3.0",
|
||||
"react-redux": "^7.2.0",
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -8,6 +8,7 @@ const defaultConfig = {
|
||||
loginBackgroundURL: 'https://source.unsplash.com/random/1600x900?music',
|
||||
enableTranscodingConfig: true,
|
||||
welcomeMessage: '',
|
||||
gaTrackingId: '',
|
||||
}
|
||||
|
||||
let config
|
||||
|
||||
Reference in New Issue
Block a user