Skip to content

Commit 208072e

Browse files
Add Google Analytics tag 🎉🎉
1 parent d3183b9 commit 208072e

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

package-lock.json

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"license": "MIT",
2222
"dependencies": {
2323
"react": "^17.0.2",
24-
"react-dom": "^17.0.2"
24+
"react-dom": "^17.0.2",
25+
"react-ga": "^3.3.0"
2526
},
2627
"devDependencies": {
2728
"@babel/core": "^7.13.16",

src/App.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
import { useEffect } from 'react'
12
import './style.scss'
3+
import ReactGa from 'react-ga'
24

35
export const App = () => {
6+
useEffect(() => {
7+
ReactGa.initialize(`${process.env.REACT_APP_GA}`)
8+
ReactGa.pageview('/')
9+
}, [])
10+
411
return <h1 className="app">React Typescript Template! </h1>
512
}

0 commit comments

Comments
 (0)