Skip to content

Commit

Permalink
feat(marketplace): #44 add google analytics (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
duong-se authored Feb 6, 2020
1 parent f790ffe commit 9fa367b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"react-datasheet": "^1.4.0",
"react-datepicker": "^2.9.6",
"react-dom": "^16.12.0",
"react-ga": "^2.7.0",
"react-google-map": "^3.1.1",
"react-google-maps-loader": "^4.2.5",
"react-icons": "^3.7.0",
Expand Down
12 changes: 10 additions & 2 deletions packages/marketplace/src/core/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,17 @@ import store from './store'
import Toast from '../components/ui/toast'
import ToastMessage from '../components/ui/toast-message'
import { PortalProvider } from '@reapit/elements'
import ReactGA from 'react-ga'

if (process.env.NODE_ENV === 'production') {
Sentry.init({ dsn: process.env.SENTRY_PROJECT_URL_MARKETPLACE })
const { NODE_ENV, MARKETPLACE_GOOGLE_ANALYTICS_KEY, SENTRY_PROJECT_URL } = process.env

if (NODE_ENV !== 'development' && SENTRY_PROJECT_URL) {
Sentry.init({ dsn: (SENTRY_PROJECT_URL as any).MARKETPLACE })
}

if (NODE_ENV !== 'development' && MARKETPLACE_GOOGLE_ANALYTICS_KEY) {
ReactGA.initialize(MARKETPLACE_GOOGLE_ANALYTICS_KEY)
ReactGA.pageview(window.location.pathname + window.location.search)
}

const rootElement = document.querySelector('#root') as Element
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18408,6 +18408,11 @@ react-focus-lock@^2.1.0:
use-callback-ref "^1.2.1"
use-sidecar "^1.0.1"

react-ga@^2.7.0:
version "2.7.0"
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-2.7.0.tgz#24328f157f31e8cffbf4de74a3396536679d8d7c"
integrity sha512-AjC7UOZMvygrWTc2hKxTDvlMXEtbmA0IgJjmkhgmQQ3RkXrWR11xEagLGFGaNyaPnmg24oaIiaNPnEoftUhfXA==

react-google-map@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/react-google-map/-/react-google-map-3.1.1.tgz#e47e42287ef6bc7510422fbfd5014ab2b4a0d1b4"
Expand Down

0 comments on commit 9fa367b

Please sign in to comment.