From ace373a32fe698f2ea2316f7a1b7b5bbad025002 Mon Sep 17 00:00:00 2001 From: nicosampler Date: Tue, 1 Dec 2020 10:07:17 -0300 Subject: [PATCH 1/8] reactGA bump --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 866c77fdfb..8be9b55f58 100644 --- a/package.json +++ b/package.json @@ -215,7 +215,7 @@ "react-dom": "16.13.1", "react-final-form": "^6.5.2", "react-final-form-listeners": "^1.0.2", - "react-ga": "3.2.1", + "react-ga": "3.3.0", "react-hot-loader": "4.13.0", "react-qr-reader": "^2.2.1", "react-redux": "7.2.2", diff --git a/yarn.lock b/yarn.lock index 4ba9745a3d..78e0b2bc3a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16343,10 +16343,10 @@ react-focus-lock@^2.1.0: use-callback-ref "^1.2.1" use-sidecar "^1.0.1" -react-ga@3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.2.1.tgz#ad2a6f848cc9555d63c188d37d6e11798393e4ed" - integrity sha512-uRwNVd7seL2I2lZBE7et8Ul0r/xNDIQkZ43QmnMrcZwY8dNB5UgPjPJA6E18xFtArLgDK/dy/O0TzYqWCsMHDg== +react-ga@3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.3.0.tgz#c91f407198adcb3b49e2bc5c12b3fe460039b3ca" + integrity sha512-o8RScHj6Lb8cwy3GMrVH6NJvL+y0zpJvKtc0+wmH7Bt23rszJmnqEQxRbyrqUzk9DTJIHoP42bfO5rswC9SWBQ== react-helmet-async@^1.0.2: version "1.0.7" From 64cbc0a031373f196feb2ef73940414fd255dfc2 Mon Sep 17 00:00:00 2001 From: nicosampler Date: Tue, 1 Dec 2020 10:07:43 -0300 Subject: [PATCH 2/8] remove address from GA --- src/routes/index.tsx | 26 ++++++++++++++++++++------ src/routes/open/container/Open.tsx | 1 - src/utils/googleAnalytics.ts | 27 ++++++++++++++------------- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/routes/index.tsx b/src/routes/index.tsx index 6d439d1d9f..6f038e12aa 100644 --- a/src/routes/index.tsx +++ b/src/routes/index.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useState } from 'react' import { useSelector } from 'react-redux' -import { Redirect, Route, Switch, withRouter } from 'react-router-dom' +import { Redirect, Route, Switch, useLocation, useRouteMatch } from 'react-router-dom' import { LOAD_ADDRESS, OPEN_ADDRESS, SAFELIST_ADDRESS, SAFE_PARAM_ADDRESS, WELCOME_ADDRESS } from './routes' @@ -19,8 +19,13 @@ const Load = React.lazy(() => import('./load/container/Load')) const SAFE_ADDRESS = `${SAFELIST_ADDRESS}/:${SAFE_PARAM_ADDRESS}` -const Routes = ({ location }) => { +const Routes = (): React.ReactElement => { const [isInitialLoad, setInitialLoad] = useState(true) + const location = useLocation() + const matchSafeWithAction = useRouteMatch<{ safeAddress: string; safeAction: string }>({ + path: `${SAFELIST_ADDRESS}/:safeAddress/:safeAction`, + }) + const defaultSafe = useSelector(defaultSafeSelector) const { trackPage } = useAnalytics() @@ -31,9 +36,18 @@ const Routes = ({ location }) => { }, [location.pathname, isInitialLoad]) useEffect(() => { - const page = location.pathname + location.search - trackPage(page) - }, [location.pathname, location.search, trackPage]) + if (matchSafeWithAction) { + // prevent logging safeAddress + let safePage = `${SAFELIST_ADDRESS}/SAFE_ADDRESS` + if (matchSafeWithAction.params?.safeAction) { + safePage += `/${matchSafeWithAction.params?.safeAction}` + } + trackPage(safePage) + } else { + const page = `${location.pathname}${location.search}` + trackPage(page) + } + }, [location, matchSafeWithAction, trackPage]) return ( @@ -65,4 +79,4 @@ const Routes = ({ location }) => { ) } -export default withRouter(Routes) +export default Routes diff --git a/src/routes/open/container/Open.tsx b/src/routes/open/container/Open.tsx index 1af1761397..62aa7fc214 100644 --- a/src/routes/open/container/Open.tsx +++ b/src/routes/open/container/Open.tsx @@ -150,7 +150,6 @@ const Open = (): React.ReactElement => { ReactGA.event({ category: 'User', action: 'Created a safe', - value: safeAddress, }) removeFromStorage(SAFE_PENDING_CREATION_STORAGE_KEY) diff --git a/src/utils/googleAnalytics.ts b/src/utils/googleAnalytics.ts index 6db5ebfa62..bab51b2af8 100644 --- a/src/utils/googleAnalytics.ts +++ b/src/utils/googleAnalytics.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useState } from 'react' -import GoogleAnalytics, { EventArgs } from 'react-ga' +import ReactGA, { EventArgs } from 'react-ga' import { getNetworkInfo } from 'src/config' import { getGoogleAnalyticsTrackingID } from 'src/config' @@ -20,8 +20,12 @@ export const loadGoogleAnalytics = (): void => { if (!trackingID) { console.error('[GoogleAnalytics] - In order to use google analytics you need to add an trackingID') } else { - GoogleAnalytics.initialize(trackingID) - GoogleAnalytics.set({ + ReactGA.initialize(trackingID, { + gaOptions: { + siteSpeedSampleRate: 100, + }, + }) + ReactGA.set({ anonymizeIp: true, appName: `Gnosis Safe Multisig (${networkInfo.label})`, appId: `io.gnosis.safe.${networkInfo.label.toLowerCase()}`, @@ -50,22 +54,19 @@ export const useAnalytics = (): UseAnalyticsResponse => { fetchCookiesFromStorage() }, []) - const trackPage = useCallback( - (page) => { - if (!analyticsAllowed || !analyticsLoaded) { - return - } - GoogleAnalytics.pageview(page) - }, - [analyticsAllowed], - ) + const trackPage = (page) => { + if (!analyticsAllowed || !analyticsLoaded) { + return + } + ReactGA.pageview(page) + } const trackEvent = useCallback( (event: EventArgs) => { if (!analyticsAllowed || !analyticsLoaded) { return } - GoogleAnalytics.event(event) + ReactGA.event(event) }, [analyticsAllowed], ) From fd545b367547b57815cf97668bde78a5c10a237d Mon Sep 17 00:00:00 2001 From: nicosampler Date: Wed, 2 Dec 2020 08:37:45 -0300 Subject: [PATCH 3/8] remove unneeded option --- src/utils/googleAnalytics.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/utils/googleAnalytics.ts b/src/utils/googleAnalytics.ts index bab51b2af8..c8db0ea56f 100644 --- a/src/utils/googleAnalytics.ts +++ b/src/utils/googleAnalytics.ts @@ -20,11 +20,7 @@ export const loadGoogleAnalytics = (): void => { if (!trackingID) { console.error('[GoogleAnalytics] - In order to use google analytics you need to add an trackingID') } else { - ReactGA.initialize(trackingID, { - gaOptions: { - siteSpeedSampleRate: 100, - }, - }) + ReactGA.initialize(trackingID) ReactGA.set({ anonymizeIp: true, appName: `Gnosis Safe Multisig (${networkInfo.label})`, From 5646c187717345fd2b8ee234d3d918e0d19da6c4 Mon Sep 17 00:00:00 2001 From: nicosampler Date: Wed, 2 Dec 2020 09:00:54 -0300 Subject: [PATCH 4/8] TEST: add network concurrency to fix CI --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 0d0c883c73..853295cc1d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,6 +52,8 @@ before_install: - sudo apt-get update - sudo apt-get -y install python-pip python-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user +install: + - yarn install --network-concurrency 1 script: - yarn lint:check - yarn prettier:check From bc7a5085b92a5f15931273bda863acd3d0d8e371 Mon Sep 17 00:00:00 2001 From: nicosampler Date: Wed, 2 Dec 2020 09:36:48 -0300 Subject: [PATCH 5/8] remove network concurrency --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 853295cc1d..0d0c883c73 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,8 +52,6 @@ before_install: - sudo apt-get update - sudo apt-get -y install python-pip python-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user -install: - - yarn install --network-concurrency 1 script: - yarn lint:check - yarn prettier:check From 805f69dbcc9a65660d4c2334087528d4a32dfd5c Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Date: Fri, 4 Dec 2020 17:58:37 +0100 Subject: [PATCH 6/8] Disable travis cache --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0d0c883c73..e697c99e02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,7 +43,8 @@ matrix: - REACT_APP_GOOGLE_ANALYTICS=${REACT_APP_GOOGLE_ANALYTICS_ID_EWC} if: (branch = master AND NOT type = pull_request) OR tag IS present cache: - yarn: true + npm: false + yarn: false before_script: - if [[ -n "$TRAVIS_TAG" ]]; then export REACT_APP_ENV='production'; fi; - if [ $TRAVIS_PULL_REQUEST != "false" ]; then export PUBLIC_URL="/${REACT_APP_NETWORK}/app"; fi; From 3716056f77ade317b2e89e7642fef8d019b92ab4 Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Date: Wed, 9 Dec 2020 17:53:46 +0100 Subject: [PATCH 7/8] Set travis to use latest linux build image --- .travis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e697c99e02..0993a86993 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ if: (branch = development) OR (branch = master) OR (type = pull_request) OR (tag IS present) -sudo: required -dist: bionic +dist: focal language: node_js node_js: - '12' From c0f8b8d6af713e8e1ec1bbc5a2da385fadfb6a97 Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Date: Wed, 9 Dec 2020 19:05:38 +0100 Subject: [PATCH 8/8] Update to use python3 dependencies --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0993a86993..c457b9d3a3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,7 @@ before_script: before_install: # Needed to deploy pull request and releases - sudo apt-get update - - sudo apt-get -y install python-pip python-dev libusb-1.0-0-dev libudev-dev + - sudo apt-get -y install python3-pip python3-dev libusb-1.0-0-dev libudev-dev - pip install awscli --upgrade --user script: - yarn lint:check