aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorThomas Schmidt <tomhschmidt@thomass-mbp-2.lan>2018-02-06 07:57:29 +0800
committerThomas Schmidt <tomhschmidt@thomass-mbp-2.lan>2018-02-06 07:57:29 +0800
commit598ce0d40129b7426d47404a3e6ff886c2e186b9 (patch)
treeffe949a0707f8516c31817be53cf3e47119648b0 /packages
parent4ddb86df53802fe5c965724d965d281528a97971 (diff)
downloaddexon-sol-tools-598ce0d40129b7426d47404a3e6ff886c2e186b9.tar
dexon-sol-tools-598ce0d40129b7426d47404a3e6ff886c2e186b9.tar.gz
dexon-sol-tools-598ce0d40129b7426d47404a3e6ff886c2e186b9.tar.bz2
dexon-sol-tools-598ce0d40129b7426d47404a3e6ff886c2e186b9.tar.lz
dexon-sol-tools-598ce0d40129b7426d47404a3e6ff886c2e186b9.tar.xz
dexon-sol-tools-598ce0d40129b7426d47404a3e6ff886c2e186b9.tar.zst
dexon-sol-tools-598ce0d40129b7426d47404a3e6ff886c2e186b9.zip
Switch GA to React GA and add logging for Portal
Diffstat (limited to 'packages')
-rw-r--r--packages/website/package.json1
-rw-r--r--packages/website/public/index.html12
-rw-r--r--packages/website/ts/components/inputs/allowance_toggle.tsx13
-rw-r--r--packages/website/ts/globals.d.ts1
-rw-r--r--packages/website/ts/index.tsx2
5 files changed, 22 insertions, 7 deletions
diff --git a/packages/website/package.json b/packages/website/package.json
index 295675fa3..ad9fc3055 100644
--- a/packages/website/package.json
+++ b/packages/website/package.json
@@ -42,6 +42,7 @@
"react-copy-to-clipboard": "^4.2.3",
"react-document-title": "^2.0.3",
"react-dom": "15.6.1",
+ "react-ga": "^2.4.1",
"react-highlight": "^0.10.0",
"react-html5video": "^2.1.0",
"react-inlinesvg": "^0.5.5",
diff --git a/packages/website/public/index.html b/packages/website/public/index.html
index c6f2f666c..aeef03fe9 100644
--- a/packages/website/public/index.html
+++ b/packages/website/public/index.html
@@ -23,13 +23,13 @@
<body style="margin: 0px; min-width: 355px;">
<!-- Google Analytics -->
<script>
- (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
- (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
- m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
- })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
+ // (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+ // (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+ // m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+ // })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
- ga('create', 'UA-98720122-1', 'auto');
- ga('send', 'pageview');
+ // ga('create', 'UA-98720122-1', 'auto');
+ // ga('send', 'pageview');
</script>
<!-- End Google Analytics -->
<!-- Facebook SDK -->
diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx
index 45531e74b..26c693dee 100644
--- a/packages/website/ts/components/inputs/allowance_toggle.tsx
+++ b/packages/website/ts/components/inputs/allowance_toggle.tsx
@@ -2,6 +2,7 @@ import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import Toggle from 'material-ui/Toggle';
import * as React from 'react';
+import * as ReactGA from 'react-ga';
import { Blockchain } from 'ts/blockchain';
import { Dispatcher } from 'ts/redux/dispatcher';
import { BalanceErrs, Token, TokenState } from 'ts/types';
@@ -74,7 +75,17 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow
newAllowanceAmountInBaseUnits = DEFAULT_ALLOWANCE_AMOUNT_IN_BASE_UNITS;
}
try {
- await this.props.blockchain.setProxyAllowanceAsync(this.props.token, newAllowanceAmountInBaseUnits);
+ await this.props.blockchain.setProxyAllowanceAsync(this.props.token, newAllowanceAmountInBaseUnits)
+ .then((fulfilled: any) => {
+ ReactGA.event({
+ category: 'Portal',
+ action: 'Set Allowance',
+ label: this.props.token.symbol,
+ value: newAllowanceAmountInBaseUnits,
+ });
+ }, (rejected: any) => {
+ console.log(rejected);
+ });
await this.props.refetchTokenStateAsync();
} catch (err) {
this.setState({
diff --git a/packages/website/ts/globals.d.ts b/packages/website/ts/globals.d.ts
index d7f887c6d..19237db14 100644
--- a/packages/website/ts/globals.d.ts
+++ b/packages/website/ts/globals.d.ts
@@ -11,6 +11,7 @@ declare module 'react-highlight';
declare module 'react-recaptcha';
declare module 'react-document-title';
declare module 'ethereumjs-tx';
+declare module 'react-ga';
declare module '*.json' {
const json: any;
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx
index ffb551561..bc4e0b472 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -2,6 +2,7 @@
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';
@@ -44,6 +45,7 @@ const LazyConnectDocumentation = createLazyComponent('Documentation', async () =
System.import<any>(/* webpackChunkName: "connectDocs" */ 'ts/containers/connect_documentation'),
);
+ReactGA.initialize('UA-98720122-1');
const store: ReduxStore<State> = createStore(reducer);
render(
<Router>