mirror of
https://github.com/status-im/safe-react.git
synced 2025-02-21 14:08:14 +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)
|
if: (branch = development) OR (branch = master) OR (type = pull_request) OR (tag IS present)
|
||||||
sudo: required
|
dist: focal
|
||||||
dist: bionic
|
|
||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- '12'
|
- '12'
|
||||||
@ -51,7 +50,7 @@ before_script:
|
|||||||
before_install:
|
before_install:
|
||||||
# Needed to deploy pull request and releases
|
# Needed to deploy pull request and releases
|
||||||
- sudo apt-get update
|
- 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
|
- pip install awscli --upgrade --user
|
||||||
script:
|
script:
|
||||||
- yarn lint:check
|
- yarn lint:check
|
||||||
|
@ -212,7 +212,7 @@
|
|||||||
"react-dom": "16.13.1",
|
"react-dom": "16.13.1",
|
||||||
"react-final-form": "^6.5.2",
|
"react-final-form": "^6.5.2",
|
||||||
"react-final-form-listeners": "^1.0.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-hot-loader": "4.13.0",
|
||||||
"react-qr-reader": "^2.2.1",
|
"react-qr-reader": "^2.2.1",
|
||||||
"react-redux": "7.2.2",
|
"react-redux": "7.2.2",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React, { useEffect, useState } from 'react'
|
import React, { useEffect, useState } from 'react'
|
||||||
import { useSelector } from 'react-redux'
|
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'
|
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 SAFE_ADDRESS = `${SAFELIST_ADDRESS}/:${SAFE_PARAM_ADDRESS}`
|
||||||
|
|
||||||
const Routes = ({ location }) => {
|
const Routes = (): React.ReactElement => {
|
||||||
const [isInitialLoad, setInitialLoad] = useState(true)
|
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 defaultSafe = useSelector(defaultSafeSelector)
|
||||||
const { trackPage } = useAnalytics()
|
const { trackPage } = useAnalytics()
|
||||||
|
|
||||||
@ -31,9 +36,18 @@ const Routes = ({ location }) => {
|
|||||||
}, [location.pathname, isInitialLoad])
|
}, [location.pathname, isInitialLoad])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const page = location.pathname + location.search
|
if (matchSafeWithAction) {
|
||||||
trackPage(page)
|
// prevent logging safeAddress
|
||||||
}, [location.pathname, location.search, trackPage])
|
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 (
|
return (
|
||||||
<Switch>
|
<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({
|
ReactGA.event({
|
||||||
category: 'User',
|
category: 'User',
|
||||||
action: 'Created a safe',
|
action: 'Created a safe',
|
||||||
value: safeAddress,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
removeFromStorage(SAFE_PENDING_CREATION_STORAGE_KEY)
|
removeFromStorage(SAFE_PENDING_CREATION_STORAGE_KEY)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useEffect, useState } from 'react'
|
import { useCallback, useEffect, useState } from 'react'
|
||||||
import GoogleAnalytics, { EventArgs } from 'react-ga'
|
import ReactGA, { EventArgs } from 'react-ga'
|
||||||
import { getNetworkInfo } from 'src/config'
|
import { getNetworkInfo } from 'src/config'
|
||||||
|
|
||||||
import { getGoogleAnalyticsTrackingID } from 'src/config'
|
import { getGoogleAnalyticsTrackingID } from 'src/config'
|
||||||
@ -20,8 +20,8 @@ export const loadGoogleAnalytics = (): void => {
|
|||||||
if (!trackingID) {
|
if (!trackingID) {
|
||||||
console.error('[GoogleAnalytics] - In order to use google analytics you need to add an trackingID')
|
console.error('[GoogleAnalytics] - In order to use google analytics you need to add an trackingID')
|
||||||
} else {
|
} else {
|
||||||
GoogleAnalytics.initialize(trackingID)
|
ReactGA.initialize(trackingID)
|
||||||
GoogleAnalytics.set({
|
ReactGA.set({
|
||||||
anonymizeIp: true,
|
anonymizeIp: true,
|
||||||
appName: `Gnosis Safe Multisig (${networkInfo.label})`,
|
appName: `Gnosis Safe Multisig (${networkInfo.label})`,
|
||||||
appId: `io.gnosis.safe.${networkInfo.label.toLowerCase()}`,
|
appId: `io.gnosis.safe.${networkInfo.label.toLowerCase()}`,
|
||||||
@ -50,22 +50,19 @@ export const useAnalytics = (): UseAnalyticsResponse => {
|
|||||||
fetchCookiesFromStorage()
|
fetchCookiesFromStorage()
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const trackPage = useCallback(
|
const trackPage = (page) => {
|
||||||
(page) => {
|
if (!analyticsAllowed || !analyticsLoaded) {
|
||||||
if (!analyticsAllowed || !analyticsLoaded) {
|
return
|
||||||
return
|
}
|
||||||
}
|
ReactGA.pageview(page)
|
||||||
GoogleAnalytics.pageview(page)
|
}
|
||||||
},
|
|
||||||
[analyticsAllowed],
|
|
||||||
)
|
|
||||||
|
|
||||||
const trackEvent = useCallback(
|
const trackEvent = useCallback(
|
||||||
(event: EventArgs) => {
|
(event: EventArgs) => {
|
||||||
if (!analyticsAllowed || !analyticsLoaded) {
|
if (!analyticsAllowed || !analyticsLoaded) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
GoogleAnalytics.event(event)
|
ReactGA.event(event)
|
||||||
},
|
},
|
||||||
[analyticsAllowed],
|
[analyticsAllowed],
|
||||||
)
|
)
|
||||||
|
@ -16649,10 +16649,10 @@ react-focus-lock@^2.1.0:
|
|||||||
use-callback-ref "^1.2.1"
|
use-callback-ref "^1.2.1"
|
||||||
use-sidecar "^1.0.1"
|
use-sidecar "^1.0.1"
|
||||||
|
|
||||||
react-ga@3.2.1:
|
react-ga@3.3.0:
|
||||||
version "3.2.1"
|
version "3.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.2.1.tgz#ad2a6f848cc9555d63c188d37d6e11798393e4ed"
|
resolved "https://registry.yarnpkg.com/react-ga/-/react-ga-3.3.0.tgz#c91f407198adcb3b49e2bc5c12b3fe460039b3ca"
|
||||||
integrity sha512-uRwNVd7seL2I2lZBE7et8Ul0r/xNDIQkZ43QmnMrcZwY8dNB5UgPjPJA6E18xFtArLgDK/dy/O0TzYqWCsMHDg==
|
integrity sha512-o8RScHj6Lb8cwy3GMrVH6NJvL+y0zpJvKtc0+wmH7Bt23rszJmnqEQxRbyrqUzk9DTJIHoP42bfO5rswC9SWBQ==
|
||||||
|
|
||||||
react-helmet-async@^1.0.2:
|
react-helmet-async@^1.0.2:
|
||||||
version "1.0.7"
|
version "1.0.7"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user