Skip to content

Commit

Permalink
Fix analytics #3
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriibudko committed Jun 19, 2023
1 parent 3966e71 commit 40f0e34
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions utils/analytics.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,12 @@ const logPageView = () => {
})
}

export const logEvent = ({
category,
action,
value,
nonInteraction = true,
}) => {
export const logEvent = () => {
if (!isGAInitialized) return

ReactGA.send({
hitType: 'reader',
page: `event /category=${category}/action=${action}/value=${value}/nonInteraction${nonInteraction}`,
page: window.location.pathname,
title: window.location.pathname,
})

Expand All @@ -51,9 +46,11 @@ export const logTiming = (options) => {
if (!isGAInitialized) return
ReactGA.send({
hitType: 'reader',
page: `logTiming ${JSON.stringify(options)}`,
page: `logTiming ${window.location.pathname}`,
title: window.location.pathname,
})
// eslint-disable-next-line no-console
console.log(JSON.stringify(options))
}

export const withGoogleAnalytics = (Page) => {
Expand Down

0 comments on commit 40f0e34

Please sign in to comment.