From dd4101f1437b25af4de00decaf539a87f38589bc Mon Sep 17 00:00:00 2001 From: dbroqua Date: Sun, 14 Apr 2019 14:45:53 +0200 Subject: [PATCH] Added GA --- package.json | 1 + src/Components/App.js | 4 ++++ yarn.lock | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/package.json b/package.json index 4852537..ab6669a 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "prop-types": "^15.7.2", "react": "^16.6.1", "react-dom": "^16.6.1", + "react-ga": "^2.5.7", "react-icons": "^3.2.2", "react-notifications": "^1.4.3", "react-router-dom": "^4.3.1", diff --git a/src/Components/App.js b/src/Components/App.js index 526ce6b..4b8d075 100644 --- a/src/Components/App.js +++ b/src/Components/App.js @@ -1,4 +1,5 @@ import React, { Component, Fragment } from 'react'; +import ReactGA from 'react-ga'; import { BrowserRouter as Router, Route, Switch, @@ -10,6 +11,9 @@ import Home from '../Routes/Home'; import Vegetables from '../Routes/Vegetables'; import Vegetable from '../Routes/Vegetable'; +ReactGA.initialize('UA-138332682-1'); +ReactGA.pageview(window.location.pathname + window.location.search); + class App extends Component { static changeBackground(background) { document.body.style.background = `url('/background/${background}.jpg') no-repeat fixed`; diff --git a/yarn.lock b/yarn.lock index eca853b..0be6667 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8205,6 +8205,11 @@ react-error-overlay@^5.1.0: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-5.1.4.tgz#88dfb88857c18ceb3b9f95076f850d7121776991" integrity sha512-fp+U98OMZcnduQ+NSEiQa4s/XMsbp+5KlydmkbESOw4P69iWZ68ZMFM5a2BuE0FgqPBKApJyRuYHR95jM8lAmg== +react-ga@^2.5.7: + version "2.5.7" + resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-2.5.7.tgz#1c80a289004bf84f84c26d46f3a6a6513081bf2e" + integrity sha512-UmATFaZpEQDO96KFjB5FRLcT6hFcwaxOmAJZnjrSiFN/msTqylq9G+z5Z8TYzN/dbamDTiWf92m6MnXXJkAivQ== + react-icons@^3.2.2: version "3.5.0" resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-3.5.0.tgz#a6135480e3bcbc63f5dd045193ef2a814263d8d1"