Skip to content

Commit

Permalink
add google tag manager for main page
Browse files Browse the repository at this point in the history
  • Loading branch information
lis-dev committed Nov 24, 2021
1 parent 8e546cc commit c63f97c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
REACT_APP_QUIZ_SERVER_URL=https://lis-dev.github.io/big5-data
REACT_APP_DEFAULT_LANG=en
REACT_APP_GTM_ID=
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"kutty": "^0.5.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-ga4": "^1.4.1",
"react-scripts": "^4.0.3",
"typescript": "^4.1.2",
"valtio": "^1.2.6",
Expand Down
6 changes: 6 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import App from './App'
import reportWebVitals from './reportWebVitals'
import { Base } from './components/Base'
import { ErrorBoundary } from './components/ErrorBoundary'
import ReactGA from 'react-ga4'

if (process.env.REACT_APP_GTM_ID) {
ReactGA.initialize(process.env.REACT_APP_GTM_ID)
ReactGA.send('pageview')
}

ReactDOM.render(
<React.StrictMode>
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9406,6 +9406,11 @@ react-error-overlay@^6.0.9:
resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.9.tgz#3c743010c9359608c375ecd6bc76f35d93995b0a"
integrity sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==

react-ga4@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/react-ga4/-/react-ga4-1.4.1.tgz#6ee2a2db115ed235b2f2092bc746b4eeeca9e206"
integrity sha512-ioBMEIxd4ePw4YtaloTUgqhQGqz5ebDdC4slEpLgy2sLx1LuZBC9iYCwDymTXzcntw6K1dHX183ulP32nNdG7w==

react-is@^16.8.1:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
Expand Down

0 comments on commit c63f97c

Please sign in to comment.