aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/relayer_index
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-06-15 01:28:02 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-06-15 06:43:10 +0800
commit677e77d0ae3f0daf9c5c6d43f73a089c24d60ea6 (patch)
tree100c8dcf3bc59996c2a95fa3e0ec056dde5dc8c5 /packages/website/ts/components/relayer_index
parent4efd28c092e74b438d0397069c0c55cc90c537f2 (diff)
downloaddexon-sol-tools-677e77d0ae3f0daf9c5c6d43f73a089c24d60ea6.tar.gz
dexon-sol-tools-677e77d0ae3f0daf9c5c6d43f73a089c24d60ea6.tar.zst
dexon-sol-tools-677e77d0ae3f0daf9c5c6d43f73a089c24d60ea6.zip
Add Portal v2 logging
Diffstat (limited to 'packages/website/ts/components/relayer_index')
-rw-r--r--packages/website/ts/components/relayer_index/relayer_grid_tile.tsx9
-rw-r--r--packages/website/ts/components/relayer_index/relayer_top_tokens.tsx7
2 files changed, 13 insertions, 3 deletions
diff --git a/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx b/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx
index fbb634164..7ff8208b0 100644
--- a/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx
+++ b/packages/website/ts/components/relayer_index/relayer_grid_tile.tsx
@@ -1,7 +1,8 @@
-import { Styles } from '@0xproject/react-shared';
+import { constants as sharedConstants, Styles } from '@0xproject/react-shared';
import * as _ from 'lodash';
import { GridTile } from 'material-ui/GridList';
import * as React from 'react';
+import { analytics } from 'ts/utils/analytics';
import { TopTokens } from 'ts/components/relayer_index/relayer_top_tokens';
import { Container } from 'ts/components/ui/container';
@@ -64,10 +65,14 @@ export const RelayerGridTile: React.StatelessComponent<RelayerGridTileProps> = (
const link = props.relayerInfo.appUrl || props.relayerInfo.url;
const topTokens = props.relayerInfo.topTokens;
const weeklyTxnVolume = props.relayerInfo.weeklyTxnVolume;
+ let trackRelayerClick = (): void => undefined;
+ const networkName = sharedConstants.NETWORK_NAME_BY_ID[props.networkId];
+ const eventLabel = `${props.relayerInfo.name}-${networkName}`;
+ trackRelayerClick = () => analytics.logEvent('Portal', 'Relayer Click', eventLabel);
return (
<Island style={styles.root} Component={GridTile}>
<div style={styles.innerDiv}>
- <a href={link} target="_blank" style={{ textDecoration: 'none' }}>
+ <a href={link} target="_blank" style={{ textDecoration: 'none' }} onClick={trackRelayerClick}>
<ImgWithFallback
src={props.relayerInfo.headerImgUrl}
fallbackSrc={FALLBACK_IMG_SRC}
diff --git a/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx b/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx
index a5754180b..75335185a 100644
--- a/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx
+++ b/packages/website/ts/components/relayer_index/relayer_top_tokens.tsx
@@ -1,6 +1,7 @@
-import { colors, EtherscanLinkSuffixes, Styles, utils as sharedUtils } from '@0xproject/react-shared';
+import { colors, constants as sharedConstants, EtherscanLinkSuffixes, Styles, utils as sharedUtils } from '@0xproject/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
+import { analytics } from 'ts/utils/analytics';
import { WebsiteBackendTokenInfo } from 'ts/types';
@@ -61,6 +62,9 @@ class TokenLink extends React.Component<TokenLinkProps, TokenLinkState> {
cursor: 'pointer',
opacity: this.state.isHovering ? 0.5 : 1,
};
+ const networkName = sharedConstants.NETWORK_NAME_BY_ID[this.props.networkId];
+ const eventLabel = `${this.props.tokenInfo.symbol}-${networkName}`;
+ const trackTokenClick = () => analytics.logEvent('Portal', 'Token Click', eventLabel);
return (
<a
href={tokenLinkFromToken(this.props.tokenInfo, this.props.networkId)}
@@ -68,6 +72,7 @@ class TokenLink extends React.Component<TokenLinkProps, TokenLinkState> {
style={style}
onMouseEnter={this._onToggleHover.bind(this, true)}
onMouseLeave={this._onToggleHover.bind(this, false)}
+ onClick={trackTokenClick}
>
{this.props.tokenInfo.symbol}
</a>