Adding Google Analytics
This commit is contained in:
parent
214a9eb5c1
commit
fd5a8786d0
@ -49,6 +49,7 @@
|
||||
"precss": "^3.1.0",
|
||||
"react": "^16.2.0",
|
||||
"react-dom": "^16.2.0",
|
||||
"react-ga": "^2.4.1",
|
||||
"react-test-renderer": "^16.2.0",
|
||||
"style-loader": "^0.20.1",
|
||||
"svg-react-loader": "^0.4.5",
|
||||
|
10
src/analytics.js
Normal file
10
src/analytics.js
Normal file
@ -0,0 +1,10 @@
|
||||
import ReactGA from 'react-ga';
|
||||
|
||||
const setupGA = () => {
|
||||
ReactGA.initialize(process.env.GA_PROPERTY, {
|
||||
debug: (process.env.NODE_ENV !== 'production')
|
||||
});
|
||||
ReactGA.pageview(document.location.pathname);
|
||||
};
|
||||
|
||||
export { setupGA };
|
@ -1 +1,4 @@
|
||||
import '../../style.css';
|
||||
import { setupGA } from '../../analytics';
|
||||
|
||||
setupGA();
|
||||
|
@ -5,5 +5,8 @@ import App from '../../components/App';
|
||||
|
||||
import '../../style.css';
|
||||
import '../../service-worker';
|
||||
import { setupGA } from '../../analytics';
|
||||
|
||||
setupGA();
|
||||
|
||||
ReactDOM.render(<App/>, document.getElementById('root'));
|
||||
|
@ -6244,6 +6244,13 @@ react-dom@^16.2.0:
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.0"
|
||||
|
||||
react-ga@^2.4.1:
|
||||
version "2.4.1"
|
||||
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-2.4.1.tgz#dfbd5f028ed39a07067f7a8bf57dc0d240000767"
|
||||
optionalDependencies:
|
||||
prop-types "^15.6.0"
|
||||
react "^15.6.2 || ^16.0"
|
||||
|
||||
react-test-renderer@^16.2.0:
|
||||
version "16.2.0"
|
||||
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.2.0.tgz#bddf259a6b8fcd8555f012afc8eacc238872a211"
|
||||
@ -6252,7 +6259,7 @@ react-test-renderer@^16.2.0:
|
||||
object-assign "^4.1.1"
|
||||
prop-types "^15.6.0"
|
||||
|
||||
react@^16.2.0:
|
||||
"react@^15.6.2 || ^16.0", react@^16.2.0:
|
||||
version "16.2.0"
|
||||
resolved "https://registry.yarnpkg.com/react/-/react-16.2.0.tgz#a31bd2dab89bff65d42134fa187f24d054c273ba"
|
||||
dependencies:
|
||||
|
Loading…
Reference in New Issue
Block a user