mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-17 03:57:04 +00:00
Remove safe address tracking for GA (#1683)
* reactGA bump * remove address from GA * remove unneeded option * Disable travis cache * Set travis to use latest linux build image * Update to use python3 dependencies Co-authored-by: Daniel Sanchez <daniel.sanchez@gnosis.pm>
This commit is contained in:
parent
9175552488
commit
2fe1fb2794
@ -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'
|
||||
@ -51,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
|
||||
|
@ -212,7 +212,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",
|
||||
|
@ -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 (
|
||||
<Switch>
|
||||
@ -65,4 +79,4 @@ const Routes = ({ location }) => {
|
||||
)
|
||||
}
|
||||
|
||||
export default withRouter(Routes)
|
||||
export default Routes
|
||||
|
@ -150,7 +150,6 @@ const Open = (): React.ReactElement => {
|
||||
ReactGA.event({
|
||||
category: 'User',
|
||||
action: 'Created a safe',
|
||||
value: safeAddress,
|
||||
})
|
||||
|
||||
removeFromStorage(SAFE_PENDING_CREATION_STORAGE_KEY)
|
||||
|
@ -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,8 @@ 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)
|
||||
ReactGA.set({
|
||||
anonymizeIp: true,
|
||||
appName: `Gnosis Safe Multisig (${networkInfo.label})`,
|
||||
appId: `io.gnosis.safe.${networkInfo.label.toLowerCase()}`,
|
||||
@ -50,22 +50,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],
|
||||
)
|
||||
|
@ -16649,10 +16649,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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user