Skip to content

Commit a3a3062

Browse files
committed
[TOOL-3111] Nebula: Add events on transaction button (#5970)
1 parent 4ffcf30 commit a3a3062

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

apps/dashboard/src/app/nebula-app/(app)/components/ExecuteTransactionCard.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
} from "thirdweb";
2121
import { useSendTransaction } from "thirdweb/react";
2222
import { TransactionButton } from "../../../../components/buttons/TransactionButton";
23+
import { useTrack } from "../../../../hooks/analytics/useTrack";
2324
import { useV5DashboardChain } from "../../../../lib/v5-adapter";
2425
import { getSDKTheme } from "../../../components/sdk-component-theme";
2526
import type { NebulaTxData } from "./Chats";
@@ -78,6 +79,7 @@ export function ExecuteTransactionCardLayout(props: {
7879
const chain = useV5DashboardChain(txData.chainId);
7980
const isTransactionSent =
8081
props.status.type === "confirming" || props.status.type === "confirmed";
82+
const trackEvent = useTrack();
8183

8284
const explorer = chain.blockExplorers?.[0]?.url;
8385

@@ -99,6 +101,13 @@ export function ExecuteTransactionCardLayout(props: {
99101
txChainID={txData.chainId}
100102
variant="default"
101103
onClick={async () => {
104+
trackEvent({
105+
category: "nebula",
106+
action: "execute_transaction",
107+
label: "attempt",
108+
chainId: txData.chainId,
109+
});
110+
102111
const tx = prepareTransaction({
103112
chain: chain,
104113
client: props.client,
@@ -115,6 +124,13 @@ export function ExecuteTransactionCardLayout(props: {
115124
const submittedReceipt = await sendTransaction.mutateAsync(tx);
116125
txHash = submittedReceipt.transactionHash;
117126

127+
trackEvent({
128+
category: "nebula",
129+
action: "execute_transaction",
130+
label: "sent",
131+
chainId: txData.chainId,
132+
});
133+
118134
// wait for receipt
119135
props.setStatus({
120136
type: "confirming",
@@ -127,6 +143,13 @@ export function ExecuteTransactionCardLayout(props: {
127143
type: "confirmed",
128144
txHash: confirmReceipt.transactionHash,
129145
});
146+
147+
trackEvent({
148+
category: "nebula",
149+
action: "execute_transaction",
150+
label: "confirmed",
151+
chainId: txData.chainId,
152+
});
130153
} catch {
131154
props.setStatus({
132155
type: "failed",

0 commit comments

Comments
 (0)