mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-13 10:47:19 +03:00
Send play song event to GA
This commit is contained in:
parent
7c3fd38559
commit
865bad1550
@ -1,4 +1,5 @@
|
||||
import React, { useCallback, useMemo } from 'react'
|
||||
import ReactGA from 'react-ga'
|
||||
import { useDispatch, useSelector } from 'react-redux'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { useAuthState, useDataProvider, useTranslate } from 'react-admin'
|
||||
@ -8,6 +9,7 @@ import subsonic from '../subsonic'
|
||||
import { scrobble, syncQueue, currentPlaying, setVolume } from './queue'
|
||||
import themes from '../themes'
|
||||
import { makeStyles } from '@material-ui/core/styles'
|
||||
import config from '../config'
|
||||
|
||||
const useStyle = makeStyles((theme) => ({
|
||||
audioTitle: {
|
||||
@ -134,6 +136,13 @@ const Player = () => {
|
||||
document.title = `${info.name} - ${info.singer} - Navidrome`
|
||||
dispatch(scrobble(info.trackId, false))
|
||||
subsonic.scrobble(info.trackId, false)
|
||||
if (config.gaTrackingId) {
|
||||
ReactGA.event({
|
||||
category: 'Player',
|
||||
action: 'Play song',
|
||||
label: `${info.name} - ${info.singer}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
[dispatch]
|
||||
|
Loading…
x
Reference in New Issue
Block a user