22 lines
509 B
JavaScript
22 lines
509 B
JavaScript
import ReactGA from 'react-ga'
|
|
|
|
export const initGA = () => {
|
|
ReactGA.initialize('UA-129143411-1')
|
|
}
|
|
|
|
export const logPageView = () => {
|
|
ReactGA.set({ page: window.location.pathname })
|
|
ReactGA.pageview(window.location.pathname)
|
|
}
|
|
|
|
export const logEvent = (category = '', action = '') => {
|
|
if (category && action) {
|
|
ReactGA.event({ category, action })
|
|
}
|
|
}
|
|
|
|
export const logException = (description = '', fatal = false) => {
|
|
if (description) {
|
|
ReactGA.exception({ description, fatal })
|
|
}
|
|
} |