aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-28 01:50:56 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-28 01:50:56 +0800
commitbe787a0fd19a658cbf21eb90140c76779647dfbc (patch)
treee3d396c6a29ebca194b29b75886c9b9b9db43e4f
parentfdc4a4e5fa31d8797abf6313f4488147853ed77e (diff)
downloaddexon-0x-contracts-be787a0fd19a658cbf21eb90140c76779647dfbc.tar.gz
dexon-0x-contracts-be787a0fd19a658cbf21eb90140c76779647dfbc.tar.zst
dexon-0x-contracts-be787a0fd19a658cbf21eb90140c76779647dfbc.zip
feat(instant): Add analytics events for payment dropdown
-rw-r--r--packages/instant/src/components/payment_method_dropdown.tsx14
-rw-r--r--packages/instant/src/components/ui/dropdown.tsx8
-rw-r--r--packages/instant/src/util/analytics.ts6
3 files changed, 26 insertions, 2 deletions
diff --git a/packages/instant/src/components/payment_method_dropdown.tsx b/packages/instant/src/components/payment_method_dropdown.tsx
index b330dbcd6..7d7fecbc2 100644
--- a/packages/instant/src/components/payment_method_dropdown.tsx
+++ b/packages/instant/src/components/payment_method_dropdown.tsx
@@ -3,6 +3,7 @@ import copy from 'copy-to-clipboard';
import * as React from 'react';
import { Network } from '../types';
+import { analytics } from '../util/analytics';
import { envUtil } from '../util/env';
import { etherscanUtil } from '../util/etherscan';
import { format } from '../util/format';
@@ -20,7 +21,14 @@ export class PaymentMethodDropdown extends React.Component<PaymentMethodDropdown
const { accountAddress, accountEthBalanceInWei } = this.props;
const value = format.ethAddress(accountAddress);
const label = format.ethBaseUnitAmount(accountEthBalanceInWei, 4, '') as string;
- return <Dropdown value={value} label={label} items={this._getDropdownItemConfigs()} />;
+ return (
+ <Dropdown
+ value={value}
+ label={label}
+ items={this._getDropdownItemConfigs()}
+ onOpen={analytics.trackPaymentMethodDropdownOpened}
+ />
+ );
}
private readonly _getDropdownItemConfigs = (): DropdownItemConfig[] => {
if (envUtil.isMobileOperatingSystem()) {
@@ -37,11 +45,15 @@ export class PaymentMethodDropdown extends React.Component<PaymentMethodDropdown
return [viewOnEtherscan, copyAddressToClipboard];
};
private readonly _handleEtherscanClick = (): void => {
+ analytics.trackPaymentMethodOpenedEtherscan();
+
const { accountAddress, network } = this.props;
const etherscanUrl = etherscanUtil.getEtherScanEthAddressIfExists(accountAddress, network);
window.open(etherscanUrl, '_blank');
};
private readonly _handleCopyToClipboardClick = (): void => {
+ analytics.trackPaymentMethodCopiedAddress();
+
const { accountAddress } = this.props;
copy(accountAddress);
};
diff --git a/packages/instant/src/components/ui/dropdown.tsx b/packages/instant/src/components/ui/dropdown.tsx
index 3a23f456d..02e87d639 100644
--- a/packages/instant/src/components/ui/dropdown.tsx
+++ b/packages/instant/src/components/ui/dropdown.tsx
@@ -19,6 +19,7 @@ export interface DropdownProps {
value: string;
label?: string;
items: DropdownItemConfig[];
+ onOpen?: () => void;
}
export interface DropdownState {
@@ -97,9 +98,14 @@ export class Dropdown extends React.Component<DropdownProps, DropdownState> {
if (_.isEmpty(this.props.items)) {
return;
}
+ const isOpen = !this.state.isOpen;
this.setState({
- isOpen: !this.state.isOpen,
+ isOpen,
});
+
+ if (isOpen && this.props.onOpen) {
+ this.props.onOpen();
+ }
};
private readonly _closeDropdown = (): void => {
this.setState({
diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts
index cec99dd1b..1c7774b73 100644
--- a/packages/instant/src/util/analytics.ts
+++ b/packages/instant/src/util/analytics.ts
@@ -20,6 +20,9 @@ enum EventNames {
ACCOUNT_UNLOCK_REQUESTED = 'Account - Unlock Requested',
ACCOUNT_UNLOCK_DENIED = 'Account - Unlock Denied',
ACCOUNT_ADDRESS_CHANGED = 'Account - Address Changed',
+ PAYMENT_METHOD_DROPDOWN_OPENED = 'Payment Method - Dropdown Opened',
+ PAYMENT_METHOD_OPENED_ETHERSCAN = 'Payment Method - Opened Etherscan',
+ PAYMENT_METHOD_COPIED_ADDRESS = 'Payment Method - Copied Address',
}
const track = (eventName: EventNames, eventProperties: EventProperties = {}): void => {
evaluateIfEnabled(() => {
@@ -94,4 +97,7 @@ export const analytics = {
trackAccountUnlockDenied: trackingEventFnWithoutPayload(EventNames.ACCOUNT_UNLOCK_DENIED),
trackAccountAddressChanged: (address: string) =>
trackingEventFnWithPayload(EventNames.ACCOUNT_ADDRESS_CHANGED)({ address }),
+ trackPaymentMethodDropdownOpened: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_DROPDOWN_OPENED),
+ trackPaymentMethodOpenedEtherscan: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_OPENED_ETHERSCAN),
+ trackPaymentMethodCopiedAddress: trackingEventFnWithoutPayload(EventNames.PAYMENT_METHOD_COPIED_ADDRESS),
};
t.cgi/freebsd-ports/commit/x11-toolkits/wxgtk26?id=1769b074fe4658d1c41687f33efe5d6bcad18fe2'>- Fix PORTREVISION here is ?= neededMartin Wilke2008-04-201-1/+1 * - Remove unneeded dependency from gtk12/gtk20 [1]Martin Wilke2008-04-201-11/+9 * Fix coredump: use gtk_border_free() insead of g_free()Max Khon2007-11-253-1/+23 * wxgtk2-contrib-common should not depend on wxgtk2.Max Khon2007-10-281-1/+1 * Remove always-false/true conditions based on OSVERSION 500000Edwin Groothuis2007-10-041-7/+1 * Remove gstreamer 0.8 support. Ports that need gstreamer support in wxWidgetsMax Khon2007-05-261-3/+1 * - Welcome X.org 7.2 \o/.Florent Thoumie2007-05-201-1/+1 * Fix ignoring wxgtk2-unicode on 4.x (requires wchar_t).Max Khon2007-01-211-1/+7 * Move NO_LATEST_LINK to wxgtk2 2.6.Max Khon2007-01-111-0/+1 * Fix file conflicts with wxgtk-common 2.4 and 2.8 ports.Max Khon2007-01-093-6/+37 * - Use features of bsd.wx.mk, especially USE_WXPav Lucistnik2006-12-011-20/+9 * - Make X11BASE-clean.Max Khon2006-11-292-1/+10 * - Fix wxgtk2-2.6-config and wxgtk2u-2.6-config when HOME is not set --Max Khon2006-11-292-3/+23 * INSTALLS_SHLIB -> USE_LDCONFIG.Max Khon2006-09-021-1/+1 * - Update gstreamer to 0.10Michael Johnson2006-04-301-2/+2 * Remove commented out USE_GCC.Max Khon2006-04-021-1/+0 * - Update to 2.6.3Max Khon2006-04-026-46/+53 * Fix "port revision going backword".Jun Kuriyama2006-01-311-2/+1 * Chase shlib bump of libexpat.Jun Kuriyama2006-01-311-1/+2 * Specify PORTREVISION in the right place.Max Khon2006-01-181-2/+1 * Enable building of wxMediaCtrl class. Bump PORTREVISION.Thomas Gellekum2006-01-181-1/+4 * Add SHA256 checksum.Max Khon2005-11-181-0/+1 * Add a patch from WX_2_6_BRANCH:Max Khon2005-11-082-0/+24 * Update to 2.6.2.Max Khon2005-11-064-20/+21 * Fix the build w/ new glib/gtk/pango stuff, bump the PORTREVISION for chaseJeremy Messenger2005-11-051-0/+6 * Remove last remnants of wxgtk2-contrib-utils port.Max Khon2005-09-011-2/+0 * Update to 2.6.1.Max Khon2005-09-013-10/+18 * - Use | as a separator instead of comma (,)Max Khon2005-05-301-3/+3 * - wxgtk26-contrib-utils: fix the build and bump PORTREVISION.Max Khon2005-05-221-1/+3 * - Add --disable-backtrace to fix the build if devel/libexecinfo is installed.Max Khon2005-05-161-1/+3 * Finish repo-move of wxgtk2*-devel ports to wxgtk26* and update to theMax Khon2005-05-1311-146/+75 * Bump PORTREVISION to chase the glib20 shared lib version change.Joe Marcus Clarke2005-03-121-1/+1 * - Prevent endless loop in wxString::PrintV.Max Khon2005-02-221-0/+20 * Adjust CONFLICTS so that it matches all PORTREVISION's ofMax Khon2005-02-211-1/+1 * - This port conflicts with wxgtk2-contrib-devel-2.5.2Max Khon2005-02-211-0/+5 * Remove CONFLICTS on wxgtk-* ports. This is no longer true.Max Khon2005-02-201-2/+0 * Update wxgtk2*-devel to 2.5.3Max Khon2004-11-2618-123/+169 * Bump PORTREVISIONS for all ports that depend on atk or pango to ease in theJoe Marcus Clarke2004-11-081-1/+1 * Fix STC build.Max Khon2004-08-151-0/+11 * NO_LATEST_LINK=yesMax Khon2004-08-151-0/+1 * Fix LIB_DEPENDS for wxgtk2-utils-devel port.Max Khon2004-07-111-9/+5 * Patch Makefile.in in pre-configure instead of post-patch:Max Khon2004-07-071-1/+1