aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/index.tsx
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-03-10 23:53:42 +0800
committerFabio Berger <me@fabioberger.com>2018-03-10 23:53:42 +0800
commitcea8dcae3dac2265d3780c95d6581fe48e9b94a4 (patch)
tree527d82d0123ec38924c4459b833131f379e20f71 /packages/website/ts/index.tsx
parentfc7e7d9331692510b2cf5baebcff948ebf0afc07 (diff)
downloaddexon-0x-contracts-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.gz
dexon-0x-contracts-cea8dcae3dac2265d3780c95d6581fe48e9b94a4.tar.zst
dexon-0x-contracts-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.tsx12
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>