diff options
author | Fabio Berger <me@fabioberger.com> | 2018-03-10 23:53:42 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-03-10 23:53:42 +0800 |
commit | cea8dcae3dac2265d3780c95d6581fe48e9b94a4 (patch) | |
tree | 527d82d0123ec38924c4459b833131f379e20f71 /packages/website/ts/index.tsx | |
parent | fc7e7d9331692510b2cf5baebcff948ebf0afc07 (diff) | |
download | dexon-sol-tools-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar dexon-sol-tools-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.gz dexon-sol-tools-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.bz2 dexon-sol-tools-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.lz dexon-sol-tools-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.xz dexon-sol-tools-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.zst dexon-sol-tools-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.zip |
Refactor Analytics so that calls to ReactGA are all in a single module, combining the provider type util function, moving GA id to configs and using utils.onPageLoadAsync
Diffstat (limited to 'packages/website/ts/index.tsx')
-rw-r--r-- | packages/website/ts/index.tsx | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx index 1eaf6274b..d974d7511 100644 --- a/packages/website/ts/index.tsx +++ b/packages/website/ts/index.tsx @@ -2,7 +2,6 @@ import { MuiThemeProvider } from 'material-ui/styles'; import * as React from 'react'; import { render } from 'react-dom'; -import * as ReactGA from 'react-ga'; import { Provider } from 'react-redux'; import { BrowserRouter as Router, Redirect, Route, Switch } from 'react-router-dom'; import * as injectTapEventPlugin from 'react-tap-event-plugin'; @@ -17,9 +16,9 @@ import { trackedTokenStorage } from 'ts/local_storage/tracked_token_storage'; import { tradeHistoryStorage } from 'ts/local_storage/trade_history_storage'; import { reducer, State } from 'ts/redux/reducer'; import { WebsitePaths } from 'ts/types'; +import { analytics } from 'ts/utils/analytics'; import { muiTheme } from 'ts/utils/mui_theme'; import { utils } from 'ts/utils/utils'; -import * as Web3 from 'web3'; import 'whatwg-fetch'; injectTapEventPlugin(); @@ -47,13 +46,8 @@ const LazyConnectDocumentation = createLazyComponent('Documentation', async () = System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/connect_documentation'), ); -ReactGA.initialize('UA-98720122-1'); -window.onload = () => { - const providerName = (window as any).web3 - ? utils.web3ProviderToString((window as any).web3.currentProvider) - : 'NONE'; - ReactGA.ga('set', 'dimension1', providerName); -}; +analytics.init(); +analytics.logProviderAsync((window as any).web3); const store: ReduxStore<State> = createStore(reducer); render( <Router> |