Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Commit

Permalink
fix: trigger GA only on production (#1517)
Browse files Browse the repository at this point in the history
* fix: trigger GA only on production
  • Loading branch information
dionizh committed Apr 23, 2021
1 parent 3729790 commit 961a31b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions game_frontend/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ WebFont.load({
},
})

// only triggers GA on production (and with cookie consent)
const isProduction = (location.hostname.search(/codeforlife.education/i) >= 0)

if (hasAnalyticsCookiesConsent()) {
ReactGA.initialize('UA-49883146-1', {
debug: false,
testMode: process.env.NODE_ENV !== 'production',
testMode: !isProduction
})

if (process.env.NODE_ENV === 'production') {
if (isProduction) {
ReactGA.pageview(`/kurono/play/${getGameIDFromURL()}`)
}
}
Expand Down

0 comments on commit 961a31b

Please sign in to comment.