From 657329dc924913d9ab9f92ce56a0addf819e9262 Mon Sep 17 00:00:00 2001 From: gregs Date: Fri, 20 Dec 2024 09:13:23 -0300 Subject: [PATCH] update events --- src/analytics/event.ts | 6 +++++- src/screens/NoNeedWCSheet.tsx | 5 ++++- src/walletConnect/index.tsx | 20 +++++++++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/analytics/event.ts b/src/analytics/event.ts index 435484aff24..73d0618591e 100644 --- a/src/analytics/event.ts +++ b/src/analytics/event.ts @@ -368,7 +368,11 @@ export type EventProperties = { dappName: string; dappUrl: string; }; - [event.wcRequestFailed]: { reason: string }; + [event.wcRequestFailed]: { + type: 'session_proposal' | 'session_request' | 'read only wallet' | 'method not supported' | 'invalid namespaces' | 'dapp browser'; + reason: string; + method?: string; + }; [event.nftOffersOpenedOffersSheet]: { entryPoint: string; diff --git a/src/screens/NoNeedWCSheet.tsx b/src/screens/NoNeedWCSheet.tsx index e2c7e7774b2..20db99f2262 100644 --- a/src/screens/NoNeedWCSheet.tsx +++ b/src/screens/NoNeedWCSheet.tsx @@ -27,7 +27,10 @@ const WalletConnectRedirectSheet = () => { const { params } = useRoute(); useEffect(() => { - analyticsV2.track(analyticsV2.event.wcRequestFailed, { reason: 'rainbow dapp browser' }); + analyticsV2.track(analyticsV2.event.wcRequestFailed, { + type: 'dapp browser', + reason: 'tried to connect with WalletConnect in the dapp browser', + }); }, []); const handleOnPress = useCallback(() => { diff --git a/src/walletConnect/index.tsx b/src/walletConnect/index.tsx index f49c5baf210..5c1ec85cab1 100644 --- a/src/walletConnect/index.tsx +++ b/src/walletConnect/index.tsx @@ -540,7 +540,7 @@ export async function onSessionProposal(proposal: WalletKitTypes.SessionProposal reason: 'INVALID_SESSION_SETTLE_REQUEST', }); - analyticsV2.track(analyticsV2.event.wcRequestFailed, { reason: `invalid namespaces: ${namespaces}` }); + analyticsV2.track(analyticsV2.event.wcRequestFailed, { type: `invalid namespaces`, reason: namespaces.error.message }); showErrorSheet({ title: lang.t(T.errors.generic_title), @@ -651,7 +651,10 @@ export async function onSessionRequest(event: SignClientTypes.EventArguments['se message, }); - analyticsV2.track(analyticsV2.event.wcRequestFailed, { reason: 'invalid signing request' }); + analyticsV2.track(analyticsV2.event.wcRequestFailed, { + type: 'session_request', + reason: 'session_request exited, signing request had no address and/or messsage', + }); await client.respondSessionRequest({ topic, @@ -683,7 +686,10 @@ export async function onSessionRequest(event: SignClientTypes.EventArguments['se const errorMessageBody = isReadOnly ? lang.t(T.errors.read_only_wallet_on_signing_method) : lang.t(T.errors.generic_error); - analyticsV2.track(analyticsV2.event.wcRequestFailed, { reason: 'read only wallet' }); + analyticsV2.track(analyticsV2.event.wcRequestFailed, { + type: 'read only wallet', + reason: 'session_request exited, selectedWallet was falsy or read only', + }); await client.respondSessionRequest({ topic, @@ -708,7 +714,7 @@ export async function onSessionRequest(event: SignClientTypes.EventArguments['se if (!session) { logger.error(new RainbowError(`[walletConnect]: session_request topic was not found`)); - analyticsV2.track(analyticsV2.event.wcRequestFailed, { reason: 'session not found' }); + analyticsV2.track(analyticsV2.event.wcRequestFailed, { type: 'session_request', reason: 'session_request topic was not found' }); await client.respondSessionRequest({ topic, @@ -775,7 +781,11 @@ export async function onSessionRequest(event: SignClientTypes.EventArguments['se method, }); - analyticsV2.track(analyticsV2.event.wcRequestFailed, { reason: `method not supported: ${method}` }); + analyticsV2.track(analyticsV2.event.wcRequestFailed, { + type: `method not supported`, + reason: 'received unsupported session_request RPC method', + method: method, + }); try { await client.respondSessionRequest({