aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website
diff options
context:
space:
mode:
Diffstat (limited to 'packages/website')
-rw-r--r--packages/website/ts/index.tsx8
-rw-r--r--packages/website/ts/utils/utils.ts25
2 files changed, 26 insertions, 7 deletions
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx
index c0539c6d0..1eaf6274b 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -18,6 +18,8 @@ import { tradeHistoryStorage } from 'ts/local_storage/trade_history_storage';
import { reducer, State } from 'ts/redux/reducer';
import { WebsitePaths } from 'ts/types';
import { muiTheme } from 'ts/utils/mui_theme';
+import { utils } from 'ts/utils/utils';
+import * as Web3 from 'web3';
import 'whatwg-fetch';
injectTapEventPlugin();
@@ -46,6 +48,12 @@ const LazyConnectDocumentation = createLazyComponent('Documentation', async () =
);
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);
+};
const store: ReduxStore<State> = createStore(reducer);
render(
<Router>
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index 308b4bb5c..a40db805b 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -1,4 +1,4 @@
-import { ECSignature, ExchangeContractErrs, ZeroEx, ZeroExError } from '0x.js';
+import { ECSignature, ExchangeContractErrs, Web3Provider, ZeroEx, ZeroExError } from '0x.js';
import { constants as sharedConstants, EtherscanLinkSuffixes, Networks } from '@0xproject/react-shared';
import { BigNumber } from '@0xproject/utils';
import deepEqual = require('deep-equal');
@@ -262,6 +262,23 @@ export const utils = {
);
return isTestNetwork;
},
+ getCurrentBaseUrl() {
+ const port = window.location.port;
+ const hasPort = !_.isUndefined(port);
+ const baseUrl = `https://${window.location.hostname}${hasPort ? `:${port}` : ''}`;
+ return baseUrl;
+ },
+ web3ProviderToString(provider: Web3Provider): string {
+ let parsedProviderName = provider.constructor.name;
+ if (provider.constructor.name === 'MetamaskInpageProvider') {
+ parsedProviderName = 'METAMASK';
+ } else if (provider.constructor.name === 'EthereumProvider') {
+ parsedProviderName = 'MIST';
+ } else if ((provider as any).isParity) {
+ parsedProviderName = 'PARITY';
+ }
+ return parsedProviderName;
+ },
async onPageLoadAsync(): Promise<void> {
if (document.readyState === 'complete') {
return; // Already loaded
@@ -270,10 +287,4 @@ export const utils = {
window.onload = () => resolve();
});
},
- getCurrentBaseUrl() {
- const port = window.location.port;
- const hasPort = !_.isUndefined(port);
- const baseUrl = `https://${window.location.hostname}${hasPort ? `:${port}` : ''}`;
- return baseUrl;
- },
};