From 7be383bb0be29182926a6713465d7fca10e17010 Mon Sep 17 00:00:00 2001 From: Shankar Date: Mon, 27 Aug 2018 15:12:15 +0530 Subject: [PATCH] feat/remove_ga: removed google analytic tracking code Removed GA code and also its deps. --- package.json | 1 - src/constants.js | 3 +-- src/containers/404.js | 4 ++-- src/containers/app.js | 2 -- src/containers/core_technology.js | 4 ++-- src/containers/discover.js | 4 ++-- src/containers/home.js | 4 ++-- src/containers/licensing.js | 4 ++-- src/containers/partials/withTracker.js | 25 ------------------------- src/containers/partials/wrapper.js | 11 +++++++++++ src/containers/platform.js | 4 ++-- src/containers/start_developing.js | 4 ++-- src/index.js | 3 --- yarn.lock | 16 ---------------- 14 files changed, 26 insertions(+), 63 deletions(-) delete mode 100644 src/containers/partials/withTracker.js create mode 100644 src/containers/partials/wrapper.js diff --git a/package.json b/package.json index 1b3b6b8..3b5bc3e 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "classnames": "^2.2.5", "react": "^16.0.0", "react-dom": "^16.0.0", - "react-ga": "^2.5.2", "react-router": "^4.2.0", "react-scroll": "^1.7.9", "react-static": "^5.7.1", diff --git a/src/constants.js b/src/constants.js index 5ce046c..c90ce73 100644 --- a/src/constants.js +++ b/src/constants.js @@ -28,6 +28,5 @@ export default { tabTypes: { WIZARD: 'wizard', LAY_HALF: 'layout_half' - }, - GA_ID: 'UA-39610124-17' + } }; diff --git a/src/containers/404.js b/src/containers/404.js index 24186ee..2bc0a18 100644 --- a/src/containers/404.js +++ b/src/containers/404.js @@ -1,5 +1,5 @@ import React from 'react' -import withTracker from './partials/withTracker'; +import Wrapper from './partials/wrapper'; // class NotFound extends React.Component { render() { @@ -12,5 +12,5 @@ class NotFound extends React.Component { } export default () => ( - withTracker(NotFound) + Wrapper(NotFound) ); diff --git a/src/containers/app.js b/src/containers/app.js index 1ea377c..3faa6ec 100644 --- a/src/containers/app.js +++ b/src/containers/app.js @@ -1,7 +1,6 @@ import React from 'react'; import { Router, Link } from 'react-static'; import { hot } from 'react-hot-loader'; -import ReactGA from 'react-ga'; // import Routes from 'react-static-routes'; @@ -21,7 +20,6 @@ class App extends React.Component { componentDidMount() { window.addEventListener('scroll', this.handleScroll); - ReactGA.pageview(window.location.pathname + window.location.search); } handleScroll(e) { diff --git a/src/containers/core_technology.js b/src/containers/core_technology.js index fb01a92..760c75c 100644 --- a/src/containers/core_technology.js +++ b/src/containers/core_technology.js @@ -1,7 +1,7 @@ import React from 'react' import { withRouteData } from 'react-static' // -import withTracker from './partials/withTracker'; +import Wrapper from './partials/wrapper'; import NetworkLayers from '../../public/images/network_layer.svg'; class CoreDeveloper extends React.Component { @@ -165,5 +165,5 @@ class CoreDeveloper extends React.Component { } export default withRouteData(({ data }) => ( - withTracker(CoreDeveloper, data) + Wrapper(CoreDeveloper, data) )) diff --git a/src/containers/discover.js b/src/containers/discover.js index 5d4e7cd..7f9aa57 100644 --- a/src/containers/discover.js +++ b/src/containers/discover.js @@ -2,7 +2,7 @@ import React from 'react' import { withRouteData } from 'react-static' import classNames from 'classnames'; import Tabs from './partials/tabs' -import withTracker from './partials/withTracker'; +import Wrapper from './partials/wrapper'; // import EcoSystemBanner from '../../public/images/ecosystem_banner.svg' import Auth1 from '../../public/images/auth_1.png' @@ -215,5 +215,5 @@ class Discover extends React.Component { } export default withRouteData(({ data }) => ( - withTracker(Discover, data) + Wrapper(Discover, data) )); diff --git a/src/containers/home.js b/src/containers/home.js index ef36d97..901ba3c 100644 --- a/src/containers/home.js +++ b/src/containers/home.js @@ -1,7 +1,7 @@ import React from 'react' import { withRouteData, Link } from 'react-static' // -import withTracker from './partials/withTracker'; +import Wrapper from './partials/wrapper'; import Contribute from '../../public/images/contribute.svg'; import Roadmap from '../../public/images/roadmap.png'; @@ -123,5 +123,5 @@ class Home extends React.Component { } export default withRouteData(({ data }) => ( - withTracker(Home, data) + Wrapper(Home, data) )); diff --git a/src/containers/licensing.js b/src/containers/licensing.js index 8353569..9de1c6c 100644 --- a/src/containers/licensing.js +++ b/src/containers/licensing.js @@ -1,7 +1,7 @@ import React from 'react' import { withRouteData } from 'react-static' // -import withTracker from './partials/withTracker'; +import Wrapper from './partials/wrapper'; import CONST from '../constants'; class Licensing extends React.Component { @@ -58,5 +58,5 @@ class Licensing extends React.Component { } export default withRouteData(({ data }) => ( - withTracker(Licensing, data) + Wrapper(Licensing, data) )); diff --git a/src/containers/partials/withTracker.js b/src/containers/partials/withTracker.js deleted file mode 100644 index 47d868d..0000000 --- a/src/containers/partials/withTracker.js +++ /dev/null @@ -1,25 +0,0 @@ -import React from 'react' -import ReactGA from 'react-ga'; -// -export default function withTracker(WrappedComponent, data = {}, options = {}) { - const trackPage = (page) => { - ReactGA.set({ - page, - ...options - }); - ReactGA.pageview(page); - }; - - class HOC extends React.Component { - componentDidMount() { - const page = window.location.pathname + window.location.search; - trackPage(page); - } - - render() { - return ; - } - }; - - return ; -} diff --git a/src/containers/partials/wrapper.js b/src/containers/partials/wrapper.js new file mode 100644 index 0000000..7138de3 --- /dev/null +++ b/src/containers/partials/wrapper.js @@ -0,0 +1,11 @@ +import React from 'react'; + +export default function wrapper(Comp, data = {}, options = {}) { + class HOC extends React.Component { + render() { + return ; + } + }; + + return ; +} diff --git a/src/containers/platform.js b/src/containers/platform.js index 9437286..f1cb737 100644 --- a/src/containers/platform.js +++ b/src/containers/platform.js @@ -3,7 +3,7 @@ import { withRouteData, Link } from 'react-static' import SyntaxHighlighter from 'react-syntax-highlighter/prism'; import { duotoneLight } from 'react-syntax-highlighter/styles/prism'; import classNames from 'classnames'; -import withTracker from './partials/withTracker'; +import Wrapper from './partials/wrapper'; import { parsePlatformData } from '../../parser'; import { animateScroll as scroll } from 'react-scroll'; @@ -117,5 +117,5 @@ class Platform extends React.Component { } export default withRouteData(({ data }) => ( - withTracker(Platform, data) + Wrapper(Platform, data) )); diff --git a/src/containers/start_developing.js b/src/containers/start_developing.js index 264d2dc..b0bf6af 100644 --- a/src/containers/start_developing.js +++ b/src/containers/start_developing.js @@ -2,7 +2,7 @@ import React from 'react' import { withRouteData } from 'react-static' import CONST from '../constants'; -import withTracker from './partials/withTracker'; +import Wrapper from './partials/wrapper'; import IntroImage from '../../public/images/app_dev_intro.svg'; import WHMLogo from '../../public/images/web_hosting_manager_rgb.svg'; @@ -174,5 +174,5 @@ class AppDev extends React.Component { } export default withRouteData(({ data }) => ( - withTracker(AppDev, data) + Wrapper(AppDev, data) )); diff --git a/src/index.js b/src/index.js index 572942f..ee3a9ac 100644 --- a/src/index.js +++ b/src/index.js @@ -1,6 +1,5 @@ import React from 'react' import ReactDOM from 'react-dom' -import ReactGA from 'react-ga' // Your top level component import CONST from './constants' @@ -9,8 +8,6 @@ import App from './containers/app' // Export your top level component as JSX (for static rendering) export default App -ReactGA.initialize(CONST.GA_ID); - // Render your app if (typeof document !== 'undefined') { const renderMethod = module.hot ? ReactDOM.render : ReactDOM.hydrate || ReactDOM.render diff --git a/yarn.lock b/yarn.lock index 96fd4c3..79c83f3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6375,13 +6375,6 @@ react-error-overlay@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-3.0.0.tgz#c2bc8f4d91f1375b3dad6d75265d51cd5eeaf655" -react-ga@^2.5.2: - version "2.5.2" - resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-2.5.2.tgz#1574b26e30ed668e4e74735527314393b22c55a9" - optionalDependencies: - prop-types "^15.6.0" - react "^15.6.2 || ^16.0" - react-helmet@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-5.2.0.tgz#a81811df21313a6d55c5f058c4aeba5d6f3d97a7" @@ -6542,15 +6535,6 @@ react@15: object-assign "^4.1.0" prop-types "^15.5.10" -"react@^15.6.2 || ^16.0": - version "16.3.2" - resolved "https://registry.yarnpkg.com/react/-/react-16.3.2.tgz#fdc8420398533a1e58872f59091b272ce2f91ea9" - dependencies: - fbjs "^0.8.16" - loose-envify "^1.1.0" - object-assign "^4.1.1" - prop-types "^15.6.0" - react@^16, react@^16.0.0: version "16.3.0" resolved "https://registry.yarnpkg.com/react/-/react-16.3.0.tgz#fc5a01c68f91e9b38e92cf83f7b795ebdca8ddff"