File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed
components/blocks/fund-wallets-modal Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -467,3 +467,39 @@ export function reportAssetPageview(properties: {
467467} ) {
468468 posthog . capture ( "asset pageview" , properties ) ;
469469}
470+
471+ /**
472+ * ### Why do we need to report this event?
473+ * - To track the usage of fund wallet modal
474+ * - To create a funnel "fund wallet modal opened" -> "fund wallet buy successful" to understand the conversion rate
475+ *
476+ * ### Who is responsible for this event?
477+ * @MananTank
478+ */
479+ export function reportFundWalletOpened ( ) {
480+ posthog . capture ( "fund wallet opened" ) ;
481+ }
482+
483+ /**
484+ * ### Why do we need to report this event?
485+ * - To track the number of successful fund wallet buys
486+ * - To create a funnel "fund wallet modal opened" -> "fund wallet buy successful" to understand the conversion rate
487+ *
488+ * ### Who is responsible for this event?
489+ * @MananTank
490+ */
491+ export function reportFundWalletSuccessful ( ) {
492+ posthog . capture ( "fund wallet successful" ) ;
493+ }
494+
495+ /**
496+ * ### Why do we need to report this event?
497+ * - To track the number of failed fund wallet buys
498+ * - To track the errors that users encounter when trying to buy from a fund wallet modal
499+ *
500+ * ### Who is responsible for this event?
501+ * @MananTank
502+ */
503+ export function reportFundWalletFailed ( params : { errorMessage : string } ) {
504+ posthog . capture ( "fund wallet failed" , params ) ;
505+ }
Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ import type { ThirdwebClient } from "thirdweb";
99import { defineChain } from "thirdweb/chains" ;
1010import { CheckoutWidget , useActiveWalletChain } from "thirdweb/react" ;
1111import { z } from "zod" ;
12+ import {
13+ reportFundWalletFailed ,
14+ reportFundWalletSuccessful ,
15+ } from "@/analytics/report" ;
1216import { SingleNetworkSelector } from "@/components/blocks/NetworkSelectors" ;
1317import { TokenSelector } from "@/components/blocks/TokenSelector" ;
1418import { Button } from "@/components/ui/button" ;
@@ -252,6 +256,14 @@ function FundWalletModalContent(props: FundWalletModalProps) {
252256 className = "!w-full !max-w-full !min-w-0 !rounded-b-none !border-none"
253257 theme = { getSDKTheme ( theme === "dark" ? "dark" : "light" ) }
254258 name = { props . checkoutWidgetTitle }
259+ onSuccess = { ( ) => {
260+ reportFundWalletSuccessful ( ) ;
261+ } }
262+ onError = { ( error ) => {
263+ reportFundWalletFailed ( {
264+ errorMessage : error . message ,
265+ } ) ;
266+ } }
255267 />
256268 </ div >
257269
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import { toast } from "sonner";
1717import { getAddress , type ThirdwebClient } from "thirdweb" ;
1818import { isAddress , shortenAddress } from "thirdweb/utils" ;
1919import { z } from "zod" ;
20+ import { reportFundWalletOpened } from "@/analytics/report" ;
2021import { FundWalletModal } from "@/components/blocks/fund-wallets-modal" ;
2122import { TWTable } from "@/components/blocks/TWTable" ;
2223import { WalletAddress } from "@/components/blocks/wallet-address" ;
@@ -268,6 +269,7 @@ export const BackendWalletsTable: React.FC<BackendWalletsTableProps> = ({
268269 onClick : ( wallet ) => {
269270 setSelectedBackendWallet ( wallet ) ;
270271 setReceiveOpen ( true ) ;
272+ reportFundWalletOpened ( ) ;
271273 } ,
272274 text : "Fund wallet" ,
273275 } ,
You can’t perform that action at this time.
0 commit comments