Skip to content

Commit 009dd88

Browse files
committed
move analytics out
1 parent ff8c970 commit 009dd88

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/App.jsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
1-
import React from 'react'
1+
import React, { useEffect } from 'react'
2+
import ReactGA from 'react-ga'
23

3-
import { Home } from './components/pages/Home'
4+
import { Config } from './config'
5+
import { Home } from './pages/Home'
46

57

6-
export const App = () => <Home />
8+
export const App = () => {
9+
10+
useEffect(() => {
11+
if (process.env.NODE_ENV === 'production') {
12+
ReactGA.initialize(Config.GoogleAnalytics)
13+
ReactGA.pageview('/')
14+
}
15+
}, [])
16+
17+
return <Home />
18+
}

src/config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const Config = {
2+
GoogleAnalytics: 'UA-136307971-1',
3+
}

0 commit comments

Comments
 (0)