aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant
diff options
context:
space:
mode:
Diffstat (limited to 'packages/instant')
-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;
}