diff --git a/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx b/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx index 0dc3b9c0a6..cf0aabd8e6 100644 --- a/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx +++ b/apps/marginfi-v2-ui/src/components/common/Wallet/Wallet.tsx @@ -3,6 +3,7 @@ import React from "react"; import { LAMPORTS_PER_SOL, GetProgramAccountsFilter, PublicKey } from "@solana/web3.js"; import { TOKEN_PROGRAM_ID } from "@solana/spl-token"; import { CopyToClipboard } from "react-copy-to-clipboard"; +import posthog from "posthog-js"; import { shortenAddress, usdFormatter, numeralFormatter } from "@mrgnlabs/mrgn-common"; @@ -86,6 +87,15 @@ export const Wallet = () => { balanceSOL: solBank ? numeralFormatter(totalBalance / solBank?.info.state.price) : "0.00", tokens: (tokens || []) as Token[], }); + + posthog.setPersonProperties({ + walletAddress: wallet?.publicKey.toString(), + tokens: tokens.map((token) => ({ + name: token?.name, + symbol: token?.symbol, + value: token?.value, + })), + }); }, [connection, wallet?.publicKey, address, solBank]); // fetch token accounts for wallet diff --git a/apps/marginfi-v2-ui/src/utils/mrgnActions.ts b/apps/marginfi-v2-ui/src/utils/mrgnActions.ts index 43b1111e5f..3923e3a391 100644 --- a/apps/marginfi-v2-ui/src/utils/mrgnActions.ts +++ b/apps/marginfi-v2-ui/src/utils/mrgnActions.ts @@ -101,6 +101,11 @@ async function createAccountAndDeposit({ try { await marginfiAccount.deposit(amount, bank.address); multiStepToast.setSuccessAndNext(); + posthog.capture("user_deposit", { + amount, + bankAddress: bank.address.toBase58(), + tokenSymbol: bank.meta.tokenSymbol, + }); } catch (error: any) { const msg = extractErrorString(error); multiStepToast.setFailed(msg);