mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-27 04:19:58 +01:00
Add initial support for Google Analytics
This commit is contained in:
parent
dd91f983b5
commit
1cc03fdd8c
7 changed files with 31 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue