Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
e56fdf3e
Unverified
Commit
e56fdf3e
authored
Oct 06, 2021
by
Justin Domingue
Committed by
GitHub
Oct 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move GA initialization to own file (#2508)
parent
bca70dd4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
23 deletions
+24
-23
index.ts
src/components/analytics/index.ts
+22
-0
index.tsx
src/index.tsx
+2
-23
No files found.
src/components/analytics/index.ts
0 → 100644
View file @
e56fdf3e
import
ReactGA
from
'
react-ga
'
import
{
isMobile
}
from
'
utils/userAgent
'
const
GOOGLE_ANALYTICS_ID
:
string
|
undefined
=
process
.
env
.
REACT_APP_GOOGLE_ANALYTICS_ID
if
(
typeof
GOOGLE_ANALYTICS_ID
===
'
string
'
)
{
ReactGA
.
initialize
(
GOOGLE_ANALYTICS_ID
,
{
gaOptions
:
{
storage
:
'
none
'
,
storeGac
:
false
,
},
})
ReactGA
.
set
({
anonymizeIp
:
true
,
customBrowserType
:
!
isMobile
?
'
desktop
'
:
'
web3
'
in
window
||
'
ethereum
'
in
window
?
'
mobileWeb3
'
:
'
mobileRegular
'
,
})
}
else
{
ReactGA
.
initialize
(
'
test
'
,
{
testMode
:
true
,
debug
:
true
})
}
src/index.tsx
View file @
e56fdf3e
import
'
inter-ui
'
import
'
@reach/dialog/styles.css
'
import
'
@reach/dialog/styles.css
'
import
'
inter-ui
'
import
'
polyfills
'
import
'
polyfills
'
import
'
components/analytics
'
import
{
createWeb3ReactRoot
,
Web3ReactProvider
}
from
'
@web3-react/core
'
import
{
createWeb3ReactRoot
,
Web3ReactProvider
}
from
'
@web3-react/core
'
import
{
StrictMode
}
from
'
react
'
import
{
StrictMode
}
from
'
react
'
import
ReactDOM
from
'
react-dom
'
import
ReactDOM
from
'
react-dom
'
import
ReactGA
from
'
react-ga
'
import
{
Provider
}
from
'
react-redux
'
import
{
Provider
}
from
'
react-redux
'
import
{
HashRouter
}
from
'
react-router-dom
'
import
{
HashRouter
}
from
'
react-router-dom
'
...
@@ -24,7 +24,6 @@ import UserUpdater from './state/user/updater'
...
@@ -24,7 +24,6 @@ import UserUpdater from './state/user/updater'
import
ThemeProvider
,
{
ThemedGlobalStyle
}
from
'
./theme
'
import
ThemeProvider
,
{
ThemedGlobalStyle
}
from
'
./theme
'
import
RadialGradientByChainUpdater
from
'
./theme/RadialGradientByChainUpdater
'
import
RadialGradientByChainUpdater
from
'
./theme/RadialGradientByChainUpdater
'
import
getLibrary
from
'
./utils/getLibrary
'
import
getLibrary
from
'
./utils/getLibrary
'
import
{
isMobile
}
from
'
./utils/userAgent
'
const
Web3ProviderNetwork
=
createWeb3ReactRoot
(
NetworkContextName
)
const
Web3ProviderNetwork
=
createWeb3ReactRoot
(
NetworkContextName
)
...
@@ -32,26 +31,6 @@ if (!!window.ethereum) {
...
@@ -32,26 +31,6 @@ if (!!window.ethereum) {
window
.
ethereum
.
autoRefreshOnNetworkChange
=
false
window
.
ethereum
.
autoRefreshOnNetworkChange
=
false
}
}
const
GOOGLE_ANALYTICS_ID
:
string
|
undefined
=
process
.
env
.
REACT_APP_GOOGLE_ANALYTICS_ID
if
(
typeof
GOOGLE_ANALYTICS_ID
===
'
string
'
)
{
ReactGA
.
initialize
(
GOOGLE_ANALYTICS_ID
,
{
gaOptions
:
{
storage
:
'
none
'
,
storeGac
:
false
,
},
})
ReactGA
.
set
({
anonymizeIp
:
true
,
customBrowserType
:
!
isMobile
?
'
desktop
'
:
'
web3
'
in
window
||
'
ethereum
'
in
window
?
'
mobileWeb3
'
:
'
mobileRegular
'
,
})
}
else
{
ReactGA
.
initialize
(
'
test
'
,
{
testMode
:
true
,
debug
:
true
})
}
function
Updaters
()
{
function
Updaters
()
{
return
(
return
(
<>
<>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment