aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-17 01:16:20 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-11-17 01:16:20 +0800
commitdf71dba8edcba5ca5731bed969748bdcc73efe92 (patch)
tree0ad0dcc2eccdcb1e13162e5c33268b1a5241d1b1
parent37d60dc39ea6476c3185e124175cb02d5e830250 (diff)
downloaddexon-sol-tools-df71dba8edcba5ca5731bed969748bdcc73efe92.tar.gz
dexon-sol-tools-df71dba8edcba5ca5731bed969748bdcc73efe92.tar.zst
dexon-sol-tools-df71dba8edcba5ca5731bed969748bdcc73efe92.zip
Make user and event properties more specific
-rw-r--r--packages/instant/src/util/analytics.ts15
-rw-r--r--packages/instant/src/util/heap.ts6
2 files changed, 16 insertions, 5 deletions
diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts
index 30193839e..92f717f7b 100644
--- a/packages/instant/src/util/analytics.ts
+++ b/packages/instant/src/util/analytics.ts
@@ -23,12 +23,21 @@ function trackingEventFnWithPayload<T extends ObjectMap<string | number>>(
};
}
+export interface AnalyticsUserOptions {
+ ethAddress?: string;
+ ethBalanceInUnitAmount?: string;
+}
+export interface AnalyticsEventOptions {
+ embeddedHost?: string;
+ embeddedUrl?: string;
+ networkId: number;
+ providerName: string;
+}
export const analytics = {
- // TODO(sk): make these more specific
- addUserProperties: (properties: ObjectMap<string | number>): void => {
+ addUserProperties: (properties: AnalyticsUserOptions): void => {
heapUtil.evaluateHeapCall(heap => heap.addUserProperties(properties));
},
- addEventProperties: (properties: ObjectMap<string | number>): void => {
+ addEventProperties: (properties: AnalyticsEventOptions): void => {
heapUtil.evaluateHeapCall(heap => heap.addEventProperties(properties));
},
walletOpened: trackingEventFnWithoutPayload(EventNames.WALLET_OPENED),
diff --git a/packages/instant/src/util/heap.ts b/packages/instant/src/util/heap.ts
index 5fd61b4c9..e697562e4 100644
--- a/packages/instant/src/util/heap.ts
+++ b/packages/instant/src/util/heap.ts
@@ -3,13 +3,15 @@ import { logUtils } from '@0x/utils';
import { ANALYTICS_ENABLED, HEAP_ANALYTICS_DEVELOPMENT_APP_ID } from '../constants';
+import { AnalyticsEventOptions, AnalyticsUserOptions } from './analytics';
+
export interface HeapAnalytics {
loaded: boolean;
identify(id: string, idType: string): void;
track(eventName: string, eventProperties?: ObjectMap<string | number>): void;
resetIdentity(): void;
- addUserProperties(properties: ObjectMap<string | number>): void;
- addEventProperties(properties: ObjectMap<string | number>): void;
+ addUserProperties(properties: AnalyticsUserOptions): void;
+ addEventProperties(properties: AnalyticsEventOptions): void;
removeEventProperty(property: string): void;
clearEventProperties(): void;
}