diff --git a/apps/dashboard/src/@/analytics/report.ts b/apps/dashboard/src/@/analytics/report.ts index e94f62d60bb..d94b646172f 100644 --- a/apps/dashboard/src/@/analytics/report.ts +++ b/apps/dashboard/src/@/analytics/report.ts @@ -10,6 +10,7 @@ import type { Team } from "../api/team"; * ### Why do we need to report this event? * - To track the number of contracts deployed * - To track the number of contracts deployed on each chain + * - To track if the contract was deployed on the asset page vs on the deploy page * * ### Who is responsible for this event? * @jnsdls @@ -20,6 +21,7 @@ export function reportContractDeployed(properties: { chainId: number; publisher: string | undefined; contractName: string | undefined; + deploymentType?: "asset"; }) { posthog.capture("contract deployed", properties); } @@ -39,6 +41,25 @@ export function reportContractDeployFailed(properties: { posthog.capture("contract deploy failed", properties); } +/** + * ### Why do we need to report this event? + * - To track the number of contracts published + * - To understand the type of contracts published + * - To understand who publishes contracts + * + * ### Who is responsible for this event? + * @jnsdls + * + */ +export function reportContractPublished(properties: { + publisher: string; + contractName: string; + version: string; + deployType: string | undefined; +}) { + posthog.capture("contract published", properties); +} + // ---------------------------- // ONBOARDING (TEAM) // ---------------------------- @@ -148,3 +169,215 @@ export function reportOnboardingMembersUpsellPlanSelected(properties: { export function reportOnboardingCompleted() { posthog.capture("onboarding completed"); } + +// ---------------------------- +// FAUCET +// ---------------------------- +/** + * ### Why do we need to report this event? + * - To track which chain the faucet was used on + * - To track how popular specific faucets are + * + * ### Who is responsible for this event? + * @jnsdls + * + */ +export function reportFaucetUsed(properties: { + chainId: number; +}) { + posthog.capture("faucet used", { + chainId: properties.chainId, + }); +} + +// ---------------------------- +// CHAIN CONFIGURATION +// ---------------------------- +/** + * ### Why do we need to report this event? + * - To track which custom chains customers are adding that we may want to add to the app + * + * ### Who is responsible for this event? + * @jnsdls + * + */ +export function reportChainConfigurationAdded(properties: { + chainId: number; + chainName: string; + rpcURLs: readonly string[]; + nativeCurrency: { + name: string; + symbol: string; + decimals: number; + }; +}) { + posthog.capture("chain configuration added", { + chainId: properties.chainId, + chainName: properties.chainName, + rpcURLs: properties.rpcURLs, + nativeCurrency: properties.nativeCurrency, + }); +} + +// ---------------------------- +// ASSETS +// ---------------------------- + +type AssetContractType = "DropERC20" | "DropERC1155" | "DropERC721"; + +/** + * ### Why do we need to report this event? + * - To track number of successful asset purchases from the asset page + * - To track which asset and contract types are being purchased the most + * + * ### Who is responsible for this event? + * @MananTank + */ +export function reportAssetBuySuccessful(properties: { + chainId: number; + contractType: AssetContractType; + assetType: "nft" | "coin"; +}) { + posthog.capture("asset buy successful", { + chainId: properties.chainId, + contractType: properties.contractType, + assetType: properties.assetType, + }); +} + +/** + * ### Why do we need to report this event? + * - To track number of failed asset purchases from the asset page + * - To track the errors that users encounter when trying to purchase an asset + * + * ### Who is responsible for this event? + * @MananTank + */ +export function reportAssetBuyFailed(properties: { + chainId: number; + contractType: AssetContractType; + assetType: "nft" | "coin"; + error: string; +}) { + posthog.capture("asset buy failed", { + chainId: properties.chainId, + contractType: properties.contractType, + assetType: properties.assetType, + error: properties.error, + }); +} + +// Assets Landing Page ---------------------------- + +/** + * ### Why do we need to report this event? + * - To track number of asset creation started from the assets page + * - To track which asset types are being created the most + * + * ### Who is responsible for this event? + * @MananTank + */ +export function reportAssetCreationStarted(properties: { + assetType: "nft" | "coin"; +}) { + posthog.capture("asset creation started", { + assetType: properties.assetType, + }); +} + +/** + * ### Why do we need to report this event? + * - To track number of assets imported successfully from the assets page + * + * ### Who is responsible for this event? + * @MananTank + */ +export function reportAssetImportSuccessful() { + posthog.capture("asset import successful"); +} + +/** + * ### Why do we need to report this event? + * - To track number of asset import started in the assets page + * + * ### Who is responsible for this event? + * @MananTank + */ +export function reportAssetImportStarted() { + posthog.capture("asset import started"); +} + +/** + * ### Why do we need to report this event? + * - To track the steps users are configuring in the asset creation to understand if there are any drop-offs + * + * ### Who is responsible for this event? + * @MananTank + */ +export function reportAssetCreationStepConfigured( + properties: + | { + assetType: "nft"; + step: "collection-info" | "upload-assets" | "sales-settings"; + } + | { + assetType: "coin"; + step: "coin-info" | "token-distribution" | "launch-coin"; + }, +) { + posthog.capture("asset creation step configured", { + assetType: properties.assetType, + step: properties.step, + }); +} + +/** + * ### Why do we need to report this event? + * - To track number of successful asset creations + * - To track which asset types are being created the most + * + * ### Who is responsible for this event? + * @MananTank + */ +export function reportAssetCreationSuccessful(properties: { + assetType: "nft" | "coin"; + contractType: AssetContractType; +}) { + posthog.capture("asset creation successful", { + assetType: properties.assetType, + contractType: properties.contractType, + }); +} + +/** + * ### Why do we need to report this event? + * - To track number of failed asset creations + * - To track the errors that users encounter when trying to create an asset + * - To track the step that is failing in the asset creation + * + * ### Who is responsible for this event? + * @MananTank + */ +export function reportAssetCreationFailed( + properties: { contractType: AssetContractType; error: string } & ( + | { + assetType: "nft"; + step: "deploy-contract" | "mint-nfts" | "set-claim-conditions"; + } + | { + assetType: "coin"; + step: + | "deploy-contract" + | "set-claim-conditions" + | "mint-tokens" + | "airdrop-tokens"; + } + ), +) { + posthog.capture("asset creation failed", { + assetType: properties.assetType, + contractType: properties.contractType, + error: properties.error, + step: properties.step, + }); +} diff --git a/apps/dashboard/src/@/components/blocks/pricing-card.tsx b/apps/dashboard/src/@/components/blocks/pricing-card.tsx index ccb87971848..62d5ab4d0c1 100644 --- a/apps/dashboard/src/@/components/blocks/pricing-card.tsx +++ b/apps/dashboard/src/@/components/blocks/pricing-card.tsx @@ -5,7 +5,6 @@ import { Button } from "@/components/ui/button"; import { ToolTipLabel } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; import { RenewSubscriptionButton } from "components/settings/Account/Billing/renew-subscription/renew-subscription-button"; -import { useTrack } from "hooks/analytics/useTrack"; import { CheckIcon, DollarSignIcon } from "lucide-react"; import Link from "next/link"; import type React from "react"; @@ -58,7 +57,6 @@ export const PricingCard: React.FC = ({ }) => { const plan = TEAM_PLANS[billingPlan]; - const trackEvent = useTrack(); const remainingTrialDays = (activeTrialEndsAt ? remainingDays(activeTrialEndsAt) : 0) || 0; @@ -68,15 +66,6 @@ export const PricingCard: React.FC = ({ billingStatus === "noPayment" && billingPlan === "growth"; - const handleCTAClick = () => { - cta?.onClick?.(); - trackEvent({ - category: "account", - label: `${billingPlan}Plan`, - action: "click", - }); - }; - return (
= ({ buttonProps={{ variant: highlighted ? "default" : "outline", className: highlighted ? undefined : "bg-background", - onClick: handleCTAClick, + onClick: cta.onClick, }} teamSlug={teamSlug} sku={billingPlanToSkuMap[billingPlan]} @@ -181,7 +170,7 @@ export const PricingCard: React.FC = ({ {has7DayTrial ? "Start 7 Day Free Trial" : cta.label} diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx index 5a0355cc569..f51b2603c1d 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/FaucetButton.tsx @@ -1,4 +1,5 @@ "use client"; +import { reportFaucetUsed } from "@/analytics/report"; import { CopyTextButton } from "@/components/ui/CopyTextButton"; import { Spinner } from "@/components/ui/Spinner/Spinner"; import { Button } from "@/components/ui/button"; @@ -29,7 +30,6 @@ import { Turnstile } from "@marsidev/react-turnstile"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import type { CanClaimResponseType } from "app/(app)/api/testnet-faucet/can-claim/CanClaimResponseType"; import { mapV4ChainToV5Chain } from "contexts/map-chains"; -import { useTrack } from "hooks/analytics/useTrack"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useForm } from "react-hook-form"; @@ -95,17 +95,11 @@ export function FaucetButton({ chain: definedChain, client, }); - const trackEvent = useTrack(); + const queryClient = useQueryClient(); const claimMutation = useMutation({ mutationFn: async (turnstileToken: string) => { - trackEvent({ - category: "faucet", - action: "claim", - label: "attempt", - chain_id: chainId, - }); const response = await fetch("/api/testnet-faucet/claim", { method: "POST", headers: { @@ -124,20 +118,8 @@ export function FaucetButton({ } }, onSuccess: () => { - trackEvent({ - category: "faucet", - action: "claim", - label: "success", - chain_id: chainId, - }); - }, - onError: (error) => { - trackEvent({ - category: "faucet", - action: "claim", - label: "error", - chain_id: chainId, - errorMsg: error instanceof Error ? error.message : "Unknown error", + reportFaucetUsed({ + chainId, }); }, onSettled: () => { @@ -223,8 +205,9 @@ export function FaucetButton({ {canClaimFaucetQuery.data.type === "unsupported-chain" && "Faucet is empty right now"} + {/* TODO: add an upsell path here to subscribe to one of these plans */} {canClaimFaucetQuery.data.type === "paid-plan-required" && - "Faucet is only available on Starter, Growth and Pro plans."} + "Faucet is only available on Starter, Growth, Scale and Pro plans."} ); } diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx index c89ff9a7a3a..22568b02aa2 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/(chainPage)/components/client/PayModal.tsx @@ -1,7 +1,6 @@ "use client"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogTrigger } from "@/components/ui/dialog"; -import { useTrack } from "hooks/analytics/useTrack"; import { defineDashboardChain } from "lib/defineDashboardChain"; import { useTheme } from "next-themes"; import type { ThirdwebClient } from "thirdweb"; @@ -14,21 +13,11 @@ export function PayModalButton(props: { client: ThirdwebClient; }) { const { theme } = useTheme(); - const trackEvent = useTrack(); + return ( - @@ -42,35 +31,6 @@ export function PayModalButton(props: { theme={getSDKTheme(theme === "dark" ? "dark" : "light")} className="!w-auto" payOptions={{ - // biome-ignore lint/suspicious/noExplicitAny: false positive - onPurchaseSuccess(info: any) { - if ( - info.type === "crypto" && - info.status.status !== "NOT_FOUND" - ) { - trackEvent({ - category: "pay", - action: "buy", - label: "success", - type: info.type, - chainId: info.status.quote.toToken.chainId, - tokenAddress: info.status.quote.toToken.tokenAddress, - amount: info.status.quote.toAmount, - }); - } - - if (info.type === "fiat" && info.status.status !== "NOT_FOUND") { - trackEvent({ - category: "pay", - action: "buy", - label: "success", - type: info.type, - chainId: info.status.quote.toToken.chainId, - tokenAddress: info.status.quote.toToken.tokenAddress, - amount: info.status.quote.estimatedToTokenAmount, - }); - } - }, prefillBuy: { // Do not include local chain overrides for chain pages // eslint-disable-next-line no-restricted-syntax diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx index 39d15bd4cda..a990cd4e4fa 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx @@ -1,7 +1,5 @@ "use client"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; -import { useAllChainsData } from "hooks/chains/allChains"; import { toast } from "sonner"; import type { ThirdwebContract } from "thirdweb"; import { cancelAuction, cancelListing } from "thirdweb/extensions/marketplace"; @@ -20,9 +18,6 @@ export const CancelTab: React.FC = ({ isAuction, isLoggedIn, }) => { - const trackEvent = useTrack(); - const { idToChain } = useAllChainsData(); - const network = idToChain.get(contract.chain.id); const transaction = isAuction ? cancelAuction({ contract, auctionId: BigInt(id) }) : cancelListing({ contract, listingId: BigInt(id) }); @@ -36,28 +31,8 @@ export const CancelTab: React.FC = ({ transactionCount={1} isPending={cancelQuery.isPending} onClick={() => { - trackEvent({ - category: "marketplace", - action: "cancel-listing", - label: "attempt", - }); const promise = cancelQuery.mutateAsync(transaction, { - onSuccess: () => { - trackEvent({ - category: "marketplace", - action: "cancel-listing", - label: "success", - network, - }); - }, onError: (error) => { - trackEvent({ - category: "marketplace", - action: "cancel-listing", - label: "error", - network, - error, - }); console.error(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/list-form.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/list-form.tsx index ace3902fd3a..f2a9807b1bc 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/list-form.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/list-form.tsx @@ -15,8 +15,6 @@ import { import { TransactionButton } from "components/buttons/TransactionButton"; import { CurrencySelector } from "components/shared/CurrencySelector"; import { SolidityInput } from "contract-ui/components/solidity-inputs"; -import { useTrack } from "hooks/analytics/useTrack"; -import { useAllChainsData } from "hooks/chains/allChains"; import { useTxNotifications } from "hooks/useTxNotifications"; import { isAlchemySupported } from "lib/wallet/nfts/isAlchemySupported"; import { isMoralisSupported } from "lib/wallet/nfts/isMoralisSupported"; @@ -107,10 +105,8 @@ export const CreateListingsForm: React.FC = ({ mode, isInsightSupported, }) => { - const trackEvent = useTrack(); const chainId = contract.chain.id; - const { idToChain } = useAllChainsData(); - const network = idToChain.get(chainId); + const [isFormLoading, setIsFormLoading] = useState(false); const isSupportedChain = @@ -418,23 +414,8 @@ export const CreateListingsForm: React.FC = ({ await sendAndConfirmTx.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "marketplace", - action: "add-listing", - label: "success", - network, - }); setOpen(false); }, - onError: (error) => { - trackEvent({ - category: "marketplace", - action: "add-listing", - label: "error", - network, - error, - }); - }, }); auctionNotifications.onSuccess(); } diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/claim-conditions-form/index.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/claim-conditions-form/index.tsx index c5e016aeeff..75d74e4ea69 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/claim-conditions-form/index.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/claim-conditions-form/index.tsx @@ -17,7 +17,6 @@ import { MenuList, } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { CircleHelpIcon, PlusIcon } from "lucide-react"; import { Fragment, createContext, useContext, useMemo, useState } from "react"; @@ -204,7 +203,6 @@ export const ClaimConditionsForm: React.FC = ({ // if neither 1155 or 20 then it's 721 const isErc721 = !isErc20 && !isErc1155; const walletAddress = useActiveAccount()?.address; - const trackEvent = useTrack(); const isAdmin = useIsAdmin(contract); const [openSnapshotIndex, setOpenSnapshotIndex] = useState(-1); @@ -359,13 +357,6 @@ export const ClaimConditionsForm: React.FC = ({ }); const handleFormSubmit = form.handleSubmit(async (d) => { - const category = isErc20 ? "token" : "nft"; - - trackEvent({ - category, - action: "set-claim-conditions", - label: "attempt", - }); if (isErc20 && !tokenDecimals.data) { return toast.error( `Could not fetch token decimals for contract ${contract.address}`, @@ -385,11 +376,7 @@ export const ClaimConditionsForm: React.FC = ({ d.phases, ); await sendTx.mutateAsync(tx); - trackEvent({ - category, - action: "set-claim-conditions", - label: "success", - }); + saveClaimPhaseNotification.onSuccess(); const newPhases = d.phases.map((phase) => ({ @@ -401,11 +388,7 @@ export const ClaimConditionsForm: React.FC = ({ form.setValue("phases", newPhases); } catch (error) { console.error(error); - trackEvent({ - category, - action: "set-claim-conditions", - label: "error", - }); + if (error instanceof ZodError) { // biome-ignore lint/complexity/noForEach: FIXME error.errors.forEach((e) => { diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/reset-claim-eligibility.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/reset-claim-eligibility.tsx index 4948c16aff8..99ec0e80978 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/reset-claim-eligibility.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_components/claim-conditions/reset-claim-eligibility.tsx @@ -3,7 +3,6 @@ import { ToolTipLabel } from "@/components/ui/tooltip"; import { AdminOnly } from "@3rdweb-sdk/react/components/roles/admin-only"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { CircleHelpIcon } from "lucide-react"; import type { ThirdwebContract } from "thirdweb"; @@ -27,8 +26,6 @@ export const ResetClaimEligibility: React.FC = ({ isLoggedIn, isMultiphase, }) => { - const trackEvent = useTrack(); - const sendTxMutation = useSendAndConfirmTransaction(); const txNotification = useTxNotifications( @@ -37,14 +34,6 @@ export const ResetClaimEligibility: React.FC = ({ ); const handleResetClaimEligibility = () => { - const category = isErc20 ? "token" : "nft"; - - trackEvent({ - category, - action: "reset-claim-conditions", - label: "attempt", - }); - const tx = (() => { switch (true) { // erc 20 @@ -69,20 +58,9 @@ export const ResetClaimEligibility: React.FC = ({ sendTxMutation.mutate(tx, { onSuccess: () => { txNotification.onSuccess(); - trackEvent({ - category, - action: "reset-claim-conditions", - label: "success", - }); }, onError: (error) => { txNotification.onError(error); - trackEvent({ - category, - action: "reset-claim-conditions", - label: "error", - error, - }); }, }); }; diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_layout/primary-dashboard-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_layout/primary-dashboard-button.tsx index 833ded7ce9e..2a4e93c7c09 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_layout/primary-dashboard-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/_layout/primary-dashboard-button.tsx @@ -17,7 +17,7 @@ import { AddToProjectSelector, type MinimalTeamsAndProjects, } from "components/contract-components/contract-deploy-form/add-to-project-card"; -import { useTrack } from "hooks/analytics/useTrack"; + import { CodeIcon, PlusIcon } from "lucide-react"; import { CircleAlertIcon, ExternalLinkIcon } from "lucide-react"; import Link from "next/link"; @@ -29,8 +29,6 @@ import { useAddContractToProject } from "../../../../../team/[team_slug]/[projec import type { ProjectMeta } from "../../../../../team/[team_slug]/[project_slug]/contract/[chainIdOrSlug]/[contractAddress]/types"; import { buildContractPagePath } from "../_utils/contract-page-path"; -const TRACKING_CATEGORY = "add_to_dashboard_upsell"; - type AddToDashboardCardProps = { contractAddress: string; chain: Chain; @@ -144,7 +142,6 @@ function AddToProjectModalContent(props: { contractAddress: string; client: ThirdwebClient; }) { - const trackEvent = useTrack(); const addContractToProject = useAddContractToProject(); const [importSelection, setImportSelection] = useState({ @@ -160,12 +157,6 @@ function AddToProjectModalContent(props: { teamId: string; projectId: string; }) { - trackEvent({ - category: TRACKING_CATEGORY, - action: "add-to-dashboard", - label: "attempt", - contractAddress: props.contractAddress, - }); addContractToProject.mutate( { contractAddress: props.contractAddress, @@ -178,12 +169,6 @@ function AddToProjectModalContent(props: { { onSuccess: () => { toast.success("Contract added to the project successfully"); - trackEvent({ - category: TRACKING_CATEGORY, - action: "add-to-dashboard", - label: "success", - contractAddress: props.contractAddress, - }); }, onError: (err) => { if (err.message.includes("PROJECT_CONTRACT_ALREADY_EXISTS")) { @@ -191,13 +176,6 @@ function AddToProjectModalContent(props: { } else { toast.error("Failed to import contract"); } - trackEvent({ - category: TRACKING_CATEGORY, - action: "add-to-dashboard", - label: "error", - contractAddress: props.contractAddress, - error: err, - }); }, }, ); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/airdrop-tab.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/airdrop-tab.tsx index 0cb64ac9b3d..212da33ff25 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/airdrop-tab.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/airdrop-tab.tsx @@ -10,7 +10,6 @@ import { } from "@/components/ui/sheet"; import { cn } from "@/lib/utils"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { UploadIcon } from "lucide-react"; import { useState } from "react"; @@ -45,7 +44,6 @@ const AirdropTab: React.FC = ({ }>({ defaultValues: { addresses: [] }, }); - const trackEvent = useTrack(); const sendAndConfirmTx = useSendAndConfirmTransaction(); const addresses = watch("addresses"); const [open, setOpen] = useState(false); @@ -59,13 +57,6 @@ const AirdropTab: React.FC = ({
{ try { - trackEvent({ - category: "nft", - action: "airdrop", - label: "attempt", - contract_address: contract.address, - token_id: tokenId, - }); const totalOwned = await balanceOf({ contract, tokenId: BigInt(tokenId), @@ -92,25 +83,8 @@ const AirdropTab: React.FC = ({ const transaction = multicall({ contract, data }); await sendAndConfirmTx.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "airdrop", - label: "success", - contract_address: contract.address, - token_id: tokenId, - }); reset(); }, - onError: (error) => { - trackEvent({ - category: "nft", - action: "airdrop", - label: "success", - contract_address: contract.address, - token_id: tokenId, - error, - }); - }, }); airdropNotifications.onSuccess(); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/burn-tab.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/burn-tab.tsx index 515c88710bc..67fddebb3cd 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/burn-tab.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/burn-tab.tsx @@ -2,7 +2,6 @@ import { FormControl, Input } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { useForm } from "react-hook-form"; import type { ThirdwebContract } from "thirdweb"; @@ -29,7 +28,7 @@ interface BurnTabProps { const BurnTab: React.FC = ({ contract, tokenId, isLoggedIn }) => { const account = useActiveAccount(); - const trackEvent = useTrack(); + const { register, handleSubmit, @@ -58,11 +57,6 @@ const BurnTab: React.FC = ({ contract, tokenId, isLoggedIn }) => {
{ - trackEvent({ - category: "nft", - action: "burn", - label: "attempt", - }); const transaction = isErc721 ? burn721({ contract, tokenId: BigInt(tokenId) }) : burn1155({ @@ -73,11 +67,6 @@ const BurnTab: React.FC = ({ contract, tokenId, isLoggedIn }) => { }); mutate(transaction, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "burn", - label: "success", - }); onSuccess(); if (contract) { invalidateContractQuery({ @@ -88,12 +77,6 @@ const BurnTab: React.FC = ({ contract, tokenId, isLoggedIn }) => { reset(); }, onError: (error) => { - trackEvent({ - category: "nft", - action: "burn", - label: "error", - error, - }); onError(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/claim-tab.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/claim-tab.tsx index db79fcd8e42..8ebc0412b71 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/claim-tab.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/claim-tab.tsx @@ -2,7 +2,6 @@ import { Flex, FormControl, Input } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb"; @@ -23,7 +22,6 @@ const ClaimTabERC1155: React.FC = ({ tokenId, isLoggedIn, }) => { - const trackEvent = useTrack(); const address = useActiveAccount()?.address; const form = useForm<{ to: string; amount: string }>({ defaultValues: { amount: "1", to: address }, @@ -36,11 +34,6 @@ const ClaimTabERC1155: React.FC = ({ direction="column" as="form" onSubmit={form.handleSubmit(async (data) => { - trackEvent({ - category: "nft", - action: "claim", - label: "attempt", - }); if (!account) { return toast.error("No account detected"); } @@ -75,20 +68,10 @@ const ClaimTabERC1155: React.FC = ({ }; }, }); - trackEvent({ - category: "nft", - action: "claim", - label: "success", - }); + form.reset(); } catch (error) { console.error(error); - trackEvent({ - category: "nft", - action: "claim", - label: "error", - error, - }); } })} > diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/mint-supply-tab.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/mint-supply-tab.tsx index 6829cdf39df..2e712fe30bd 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/mint-supply-tab.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/mint-supply-tab.tsx @@ -12,7 +12,6 @@ import { import { Input } from "@/components/ui/input"; import { zodResolver } from "@hookform/resolvers/zod"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; import { type ThirdwebContract, isAddress } from "thirdweb"; @@ -38,7 +37,6 @@ const MintSupplyTab: React.FC = ({ tokenId, isLoggedIn, }) => { - const trackEvent = useTrack(); const address = useActiveAccount()?.address; const form = useForm>({ @@ -52,11 +50,6 @@ const MintSupplyTab: React.FC = ({ const sendAndConfirmTx = useSendAndConfirmTransaction(); function onSubmit(values: z.input) { - trackEvent({ - category: "nft", - action: "mint-supply", - label: "attempt", - }); const transaction = mintAdditionalSupplyTo({ contract, to: values.to, @@ -65,21 +58,8 @@ const MintSupplyTab: React.FC = ({ }); const promise = sendAndConfirmTx.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "mint-supply", - label: "success", - }); form.reset(); }, - onError: (error) => { - trackEvent({ - category: "nft", - action: "mint-supply", - label: "error", - error, - }); - }, }); toast.promise(promise, { loading: "Minting NFT", diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/transfer-tab.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/transfer-tab.tsx index 51225b0f317..4768866fe43 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/transfer-tab.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/transfer-tab.tsx @@ -4,7 +4,6 @@ import { GenericLoadingPage } from "@/components/blocks/skeletons/GenericLoading import { FormControl, Input } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; import { SolidityInput } from "contract-ui/components/solidity-inputs"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { useForm } from "react-hook-form"; import { type ThirdwebContract, ZERO_ADDRESS } from "thirdweb"; @@ -30,7 +29,6 @@ const TransferTab: React.FC = ({ }) => { const account = useActiveAccount(); - const trackEvent = useTrack(); const form = useForm<{ to: string; amount: string }>({ defaultValues: { to: "", amount: "1" }, }); @@ -56,11 +54,6 @@ const TransferTab: React.FC = ({
{ - trackEvent({ - category: "nft", - action: "transfer", - label: "attempt", - }); const transaction = isErc1155 ? safeTransferFrom({ contract, @@ -78,21 +71,10 @@ const TransferTab: React.FC = ({ }); sendTxAndConfirm.mutate(transaction, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "transfer", - label: "success", - }); onSuccess(); form.reset(); }, onError: (error) => { - trackEvent({ - category: "nft", - action: "transfer", - label: "error", - error, - }); onError(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/update-metadata-form.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/update-metadata-form.tsx index 2c8ca2b5d3c..03689bdbdcd 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/update-metadata-form.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/[tokenId]/components/update-metadata-form.tsx @@ -14,7 +14,6 @@ import { OpenSeaPropertyBadge } from "components/badges/opensea"; import { TransactionButton } from "components/buttons/TransactionButton"; import { PropertiesFormControl } from "components/contract-pages/forms/properties.shared"; import { FileInput } from "components/shared/FileInput"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { type Dispatch, type SetStateAction, useMemo } from "react"; import { useForm } from "react-hook-form"; @@ -65,7 +64,6 @@ export const UpdateNftMetadata: React.FC = ({ setOpen, isLoggedIn, }) => { - const trackEvent = useTrack(); const address = useActiveAccount()?.address; const transformedQueryData = useMemo(() => { @@ -126,11 +124,6 @@ export const UpdateNftMetadata: React.FC = ({ toast.error("Please connect your wallet to update metadata."); return; } - trackEvent({ - category: "nft", - action: "update-metadata", - label: "attempt", - }); try { const newMetadata = parseAttributes({ @@ -166,21 +159,10 @@ export const UpdateNftMetadata: React.FC = ({ }); await sendAndConfirmTx.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "update-metadata", - label: "success", - }); setOpen(false); }, - // biome-ignore lint/suspicious/noExplicitAny: FIXME - onError: (error: any) => { - trackEvent({ - category: "nft", - action: "update-metadata", - label: "error", - error, - }); + onError: (error) => { + console.error(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/batch-lazy-mint-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/batch-lazy-mint-button.tsx index d672316d0d1..2875c12ebac 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/batch-lazy-mint-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/batch-lazy-mint-button.tsx @@ -10,7 +10,6 @@ import { } from "@/components/ui/sheet"; import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only"; import { BatchLazyMint } from "core-ui/batch-upload/batch-lazy-mint"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { FileStackIcon } from "lucide-react"; import { useState } from "react"; @@ -32,7 +31,6 @@ export const BatchLazyMintButton: React.FC = ({ isErc721, isLoggedIn, }) => { - const trackEvent = useTrack(); const [open, setOpen] = useState(false); const nextTokenIdToMintQuery = useReadContract( @@ -71,13 +69,6 @@ export const BatchLazyMintButton: React.FC = ({ client={contract.client} chainId={contract.chain.id} onSubmit={async ({ revealType, data }) => { - // nice, we can set up everything the same for both the only thing that changes is the action string - const action = `batch-upload-${revealType}` as const; - trackEvent({ - category: "nft", - action, - label: "attempt", - }); try { const tx = (() => { switch (true) { @@ -112,20 +103,10 @@ export const BatchLazyMintButton: React.FC = ({ await sendTxMutation.mutateAsync(tx); - trackEvent({ - category: "nft", - action, - label: "success", - }); txNotifications.onSuccess(); setOpen(false); } catch (error) { - trackEvent({ - category: "nft", - action, - label: "error", - error, - }); + console.error(error); txNotifications.onError(error); } }} diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/claim-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/claim-button.tsx index 23b1d19b2be..1dc23ce2bdd 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/claim-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/claim-button.tsx @@ -10,7 +10,6 @@ import { } from "@/components/ui/sheet"; import { FormControl, Input } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { GemIcon } from "lucide-react"; import { useState } from "react"; @@ -37,7 +36,6 @@ export const NFTClaimButton: React.FC = ({ contract, isLoggedIn, }) => { - const trackEvent = useTrack(); const address = useActiveAccount()?.address; const { register, handleSubmit, formState, setValue } = useForm({ defaultValues: { amount: "1", to: address }, @@ -116,11 +114,6 @@ export const NFTClaimButton: React.FC = ({ type="submit" onClick={handleSubmit(async (d) => { try { - trackEvent({ - category: "nft", - action: "claim", - label: "attempt", - }); if (!account) { return toast.error("No account detected"); } @@ -159,20 +152,10 @@ export const NFTClaimButton: React.FC = ({ await sendAndConfirmTx.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "claim", - label: "success", - }); setOpen(false); }, onError: (error) => { - trackEvent({ - category: "nft", - action: "claim", - label: "error", - error, - }); + console.error(error); }, }); @@ -180,12 +163,6 @@ export const NFTClaimButton: React.FC = ({ } catch (error) { console.error(error); claimNFTNotifications.onError(error); - trackEvent({ - category: "nft", - action: "claim", - label: "error", - error, - }); } })} > diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/lazy-mint-form.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/lazy-mint-form.tsx index 851efebf5e3..479f8e7762a 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/lazy-mint-form.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/lazy-mint-form.tsx @@ -16,7 +16,6 @@ import { OpenSeaPropertyBadge } from "components/badges/opensea"; import { TransactionButton } from "components/buttons/TransactionButton"; import { PropertiesFormControl } from "components/contract-pages/forms/properties.shared"; import { FileInput } from "components/shared/FileInput"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import type { Dispatch, SetStateAction } from "react"; import { useForm } from "react-hook-form"; @@ -53,7 +52,6 @@ export const LazyMintNftForm: React.FC = ({ setOpen, isLoggedIn, }) => { - const trackEvent = useTrack(); const address = useActiveAccount()?.address; const sendAndConfirmTx = useSendAndConfirmTransaction(); @@ -97,11 +95,6 @@ export const LazyMintNftForm: React.FC = ({ return; } try { - trackEvent({ - category: "nft", - action: "lazy-mint", - label: "attempt", - }); const nfts = [parseAttributes(data)]; const transaction = isErc721 ? lazyMint721({ contract, nfts }) @@ -109,20 +102,10 @@ export const LazyMintNftForm: React.FC = ({ await sendAndConfirmTx.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "lazy-mint", - label: "success", - }); setOpen(false); }, onError: (error) => { - trackEvent({ - category: "nft", - action: "lazy-mint", - label: "error", - error, - }); + console.error(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/mint-form.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/mint-form.tsx index 67fce1df341..35323e3ee86 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/mint-form.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/mint-form.tsx @@ -15,7 +15,6 @@ import { OpenSeaPropertyBadge } from "components/badges/opensea"; import { TransactionButton } from "components/buttons/TransactionButton"; import { PropertiesFormControl } from "components/contract-pages/forms/properties.shared"; import { FileInput } from "components/shared/FileInput"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import type { Dispatch, SetStateAction } from "react"; import { useForm } from "react-hook-form"; @@ -53,7 +52,6 @@ export const NFTMintForm: React.FC = ({ setOpen, isLoggedIn, }) => { - const trackEvent = useTrack(); const address = useActiveAccount()?.address; const form = useForm< NFTMetadataInputLimited & { @@ -107,11 +105,6 @@ export const NFTMintForm: React.FC = ({ animation_url: data.animation_url, }; - trackEvent({ - category: "nft", - action: "mint", - label: "attempt", - }); const nft = parseAttributes(dataWithCustom); const transaction = isErc721 ? erc721MintTo({ contract, to: address, nft }) @@ -123,21 +116,10 @@ export const NFTMintForm: React.FC = ({ }); await sendAndConfirmTx.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "mint", - label: "success", - }); setOpen(false); }, - // biome-ignore lint/suspicious/noExplicitAny: FIXME - onError: (error: any) => { - trackEvent({ - category: "nft", - action: "mint", - label: "error", - error, - }); + onError: (error) => { + console.error(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/reveal-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/reveal-button.tsx index 03f7213a6e9..afd6f62fede 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/reveal-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/reveal-button.tsx @@ -12,7 +12,6 @@ import { ToolTipLabel } from "@/components/ui/tooltip"; import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only"; import { FormControl, Input, Select } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { EyeIcon } from "lucide-react"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -36,7 +35,6 @@ export const NFTRevealButton: React.FC = ({ const batchesQuery = useReadContract(getBatchesToReveal, { contract, }); - const trackEvent = useTrack(); const sendTxMutation = useSendAndConfirmTransaction(); @@ -85,12 +83,6 @@ export const NFTRevealButton: React.FC = ({ className="mt-10 flex flex-col gap-6" id={REVEAL_FORM_ID} onSubmit={handleSubmit((data) => { - trackEvent({ - category: "nft", - action: "batch-upload-reveal", - label: "attempt", - }); - const tx = reveal({ contract, batchId: BigInt(data.batchId), @@ -99,20 +91,10 @@ export const NFTRevealButton: React.FC = ({ const promise = sendTxMutation.mutateAsync(tx, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "batch-upload-reveal", - label: "success", - }); setOpen(false); }, onError: (error) => { console.error(error); - trackEvent({ - category: "nft", - action: "batch-upload-reveal", - label: "error", - }); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/shared-metadata-form.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/shared-metadata-form.tsx index 88cc8f4e313..ef244734728 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/shared-metadata-form.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/nfts/components/shared-metadata-form.tsx @@ -13,7 +13,6 @@ import { } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; import { FileInput } from "components/shared/FileInput"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import type { Dispatch, SetStateAction } from "react"; import { useForm } from "react-hook-form"; @@ -42,7 +41,6 @@ export const SharedMetadataForm: React.FC<{ setOpen: Dispatch>; isLoggedIn: boolean; }> = ({ contract, setOpen, isLoggedIn }) => { - const trackEvent = useTrack(); const address = useActiveAccount()?.address; const sendAndConfirmTx = useSendAndConfirmTransaction(); const form = useForm(); @@ -82,11 +80,6 @@ export const SharedMetadataForm: React.FC<{ animation_url: data.animation_url, }; - trackEvent({ - category: "nft", - action: "set-shared-metadata", - label: "attempt", - }); try { const transaction = setSharedMetadata({ contract, @@ -94,21 +87,10 @@ export const SharedMetadataForm: React.FC<{ }); await sendAndConfirmTx.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "nft", - action: "set-shared-metadata", - label: "success", - }); setOpen(false); }, - // biome-ignore lint/suspicious/noExplicitAny: FIXME - onError: (error: any) => { - trackEvent({ - category: "nft", - action: "set-shared-metadata", - label: "error", - error, - }); + onError: (error) => { + console.error(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx index 013d41745d8..cfde2a3a965 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/overview/components/Analytics.tsx @@ -8,7 +8,7 @@ import { useContractUniqueWalletAnalytics, } from "data/analytics/hooks"; import { differenceInCalendarDays, format } from "date-fns"; -import { useTrack } from "hooks/analytics/useTrack"; + import { ArrowRightIcon } from "lucide-react"; import Link from "next/link"; import { useMemo, useState } from "react"; @@ -31,7 +31,6 @@ export function ContractAnalyticsOverviewCard(props: { chainSlug: string; projectMeta: ProjectMeta | undefined; }) { - const trackEvent = useTrack(); const [startDate] = useState( (() => { const date = new Date(); @@ -83,13 +82,6 @@ export function ContractAnalyticsOverviewCard(props: { className="gap-2 bg-background text-muted-foreground" size="sm" variant="outline" - onClick={() => { - trackEvent({ - category: "contract_overview", - action: "click", - label: "view_all_analytics", - }); - }} > View All diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/permissions/components/index.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/permissions/components/index.tsx index 9bbd1d211cd..7ed509724c4 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/permissions/components/index.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/permissions/components/index.tsx @@ -7,7 +7,6 @@ import { createSetAllRoleMembersTx, getAllRoleMembers, } from "contract-ui/hooks/permissions"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { useMemo } from "react"; import { FormProvider, useForm } from "react-hook-form"; @@ -31,7 +30,6 @@ export function Permissions({ contract: ThirdwebContract; isLoggedIn: boolean; }) { - const trackEvent = useTrack(); const account = useActiveAccount(); const allRoleMembers = useReadContract(getAllRoleMembers, { contract, @@ -70,11 +68,6 @@ export function Permissions({ onError(new Error("Wallet not connected!")); return; } - trackEvent({ - category: "permissions", - action: "set-permissions", - label: "attempt", - }); const tx = createSetAllRoleMembersTx({ account, contract, @@ -82,21 +75,10 @@ export function Permissions({ }); sendTx.mutate(tx, { onSuccess: () => { - trackEvent({ - category: "permissions", - action: "set-permissions", - label: "success", - }); form.reset(d); onSuccess(); }, onError: (error) => { - trackEvent({ - category: "permissions", - action: "set-permissions", - label: "error", - error, - }); onError(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/proposals/components/delegate-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/proposals/components/delegate-button.tsx index 748f9edc537..e245d7b70d0 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/proposals/components/delegate-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/proposals/components/delegate-button.tsx @@ -6,7 +6,6 @@ import { useDelegateMutation, } from "@3rdweb-sdk/react/hooks/useVote"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { toast } from "sonner"; import type { ThirdwebContract } from "thirdweb"; import { useActiveAccount, useReadContract } from "thirdweb/react"; @@ -20,7 +19,6 @@ export const DelegateButton: React.FC = ({ contract, isLoggedIn, }) => { - const trackEvent = useTrack(); const account = useActiveAccount(); const tokensDelegatedQuery = useReadContract(tokensDelegated, { contract, @@ -45,20 +43,8 @@ export const DelegateButton: React.FC = ({ onClick={() => { toast.promise( delegateMutation.mutateAsync(contract, { - onSuccess: () => { - trackEvent({ - category: "vote", - action: "delegate", - label: "success", - }); - }, onError: (error) => { - trackEvent({ - category: "vote", - action: "delegate", - label: "error", - error, - }); + console.error(error); }, }), { diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/proposals/components/proposal-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/proposals/components/proposal-button.tsx index 79948ad4e19..a2e2440f6cc 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/proposals/components/proposal-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/proposals/components/proposal-button.tsx @@ -9,7 +9,6 @@ import { } from "@/components/ui/sheet"; import { FormControl, Textarea } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { PlusIcon } from "lucide-react"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -37,7 +36,7 @@ export const ProposalButton: React.FC = ({ handleSubmit, formState: { errors }, } = useForm<{ description: string }>(); - const trackEvent = useTrack(); + return ( @@ -66,21 +65,10 @@ export const ProposalButton: React.FC = ({ toast.promise( sendTx.mutateAsync(tx, { onSuccess: () => { - trackEvent({ - category: "vote", - action: "create-proposal", - label: "success", - }); setOpen(false); }, onError: (error) => { console.error(error); - trackEvent({ - category: "vote", - action: "create-proposal", - label: "error", - error, - }); }, }), { diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/claim-tokens/claim-tokens-ui.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/claim-tokens/claim-tokens-ui.tsx index a222ecf8e92..3b58ce26e95 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/claim-tokens/claim-tokens-ui.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/erc20/_components/claim-tokens/claim-tokens-ui.tsx @@ -1,4 +1,9 @@ "use client"; + +import { + reportAssetBuyFailed, + reportAssetBuySuccessful, +} from "@/analytics/report"; import { Spinner } from "@/components/ui/Spinner/Spinner"; import { Button } from "@/components/ui/button"; import { DecimalInput } from "@/components/ui/decimal-input"; @@ -7,7 +12,6 @@ import { ToolTipLabel } from "@/components/ui/tooltip"; import { cn } from "@/lib/utils"; import { useMutation, useQuery } from "@tanstack/react-query"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { CheckIcon, CircleAlertIcon, @@ -32,12 +36,9 @@ import { type getActiveClaimCondition, getApprovalForTransaction, } from "thirdweb/extensions/erc20"; -import { - useActiveAccount, - useActiveWallet, - useSendTransaction, -} from "thirdweb/react"; +import { useActiveAccount, useSendTransaction } from "thirdweb/react"; import { getClaimParams } from "thirdweb/utils"; +import { parseError } from "utils/errorParser"; import { tryCatch } from "utils/try-catch"; import { getSDKTheme } from "../../../../../../../../components/sdk-component-theme"; import { PublicPageConnectButton } from "../../../_components/PublicPageConnectButton"; @@ -63,14 +64,15 @@ export function TokenDropClaim(props: { }) { const [quantity, setQuantity] = useState("1"); const account = useActiveAccount(); - const activeWallet = useActiveWallet(); + const { theme } = useTheme(); - const trackEvent = useTrack(); + const sendClaimTx = useSendTransaction({ payModal: { theme: getSDKTheme(theme === "light" ? "light" : "dark"), }, }); + const [successScreen, setSuccessScreen] = useState< | undefined | { @@ -78,32 +80,6 @@ export function TokenDropClaim(props: { } >(undefined); - function trackAssetBuy( - params: - | { - type: "attempt" | "success"; - } - | { - type: "error"; - errorMessage: string; - }, - ) { - trackEvent({ - category: "asset", - action: "buy", - label: params.type, - contractType: "DropERC20", - accountAddress: account?.address, - walletId: activeWallet?.id, - chainId: props.contract.chain.id, - ...(params.type === "error" - ? { - errorMessage: params.errorMessage, - } - : {}), - }); - } - const [stepsUI, setStepsUI] = useState< | undefined | { @@ -119,10 +95,6 @@ export function TokenDropClaim(props: { return; } - trackAssetBuy({ - type: "attempt", - }); - setStepsUI(undefined); const transaction = claimTo({ @@ -151,19 +123,24 @@ export function TokenDropClaim(props: { ); if (approveTxResult.error) { + console.error(approveTxResult.error); + setStepsUI({ approve: "error", claim: "idle", }); - trackAssetBuy({ - type: "error", - errorMessage: approveTxResult.error.message, + const errorMessage = parseError(approveTxResult.error); + + reportAssetBuyFailed({ + chainId: props.contract.chain.id, + contractType: "DropERC20", + assetType: "coin", + error: errorMessage, }); - console.error(approveTxResult.error); toast.error("Failed to approve spending", { - description: approveTxResult.error.message, + description: errorMessage, }); return; } @@ -186,32 +163,37 @@ export function TokenDropClaim(props: { const claimTxResult = await tryCatch(sendAndConfirm()); if (claimTxResult.error) { + console.error(claimTxResult.error); + const errorMessage = parseError(claimTxResult.error); setStepsUI({ approve: approveTx ? "success" : undefined, claim: "error", }); - trackAssetBuy({ - type: "error", - errorMessage: claimTxResult.error.message, + reportAssetBuyFailed({ + chainId: props.contract.chain.id, + contractType: "DropERC20", + assetType: "coin", + error: errorMessage, }); - console.error(claimTxResult.error); toast.error("Failed to buy tokens", { - description: claimTxResult.error.message, + description: errorMessage, }); return; } + reportAssetBuySuccessful({ + chainId: props.contract.chain.id, + contractType: "DropERC20", + assetType: "coin", + }); + setStepsUI({ approve: approveTx ? "success" : undefined, claim: "success", }); - trackAssetBuy({ - type: "success", - }); - setSuccessScreen({ txHash: claimTxResult.data.transactionHash, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/buy-edition-drop/buy-edition-drop.client.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/buy-edition-drop/buy-edition-drop.client.tsx index 19e3e7411b1..4258a9ce4d4 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/buy-edition-drop/buy-edition-drop.client.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/buy-edition-drop/buy-edition-drop.client.tsx @@ -1,5 +1,9 @@ "use client"; +import { + reportAssetBuyFailed, + reportAssetBuySuccessful, +} from "@/analytics/report"; import { Form, FormControl, @@ -14,7 +18,6 @@ import { ToolTipLabel } from "@/components/ui/tooltip"; import { zodResolver } from "@hookform/resolvers/zod"; import { useQueryClient } from "@tanstack/react-query"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { CircleAlertIcon } from "lucide-react"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; @@ -22,11 +25,7 @@ import { type ThirdwebContract, toTokens } from "thirdweb"; import type { ChainMetadata } from "thirdweb/chains"; import { getApprovalForTransaction } from "thirdweb/extensions/erc20"; import { claimTo } from "thirdweb/extensions/erc1155"; -import { - useActiveAccount, - useActiveWallet, - useSendAndConfirmTransaction, -} from "thirdweb/react"; +import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react"; import { parseError } from "utils/errorParser"; import * as z from "zod"; import { PublicPageConnectButton } from "../../../_components/PublicPageConnectButton"; @@ -49,7 +48,6 @@ type BuyEditionDropProps = { }; export function BuyEditionDrop(props: BuyEditionDropProps) { - const trackEvent = useTrack(); const form = useForm>({ resolver: zodResolver(formSchema), defaultValues: { @@ -60,7 +58,7 @@ export function BuyEditionDrop(props: BuyEditionDropProps) { const nftAmountToClaim = Number(form.watch("amount")); const sendAndConfirmTx = useSendAndConfirmTransaction(); const account = useActiveAccount(); - const activeWallet = useActiveWallet(); + const queryClient = useQueryClient(); const { @@ -75,39 +73,8 @@ export function BuyEditionDrop(props: BuyEditionDropProps) { enabled: true, }); - function trackAssetBuy( - params: - | { - type: "attempt" | "success"; - } - | { - type: "error"; - errorMessage: string; - }, - ) { - trackEvent({ - category: "asset", - action: "buy", - label: params.type, - contractType: "NFTCollection", - ercType: "erc1155", - accountAddress: account?.address, - walletId: activeWallet?.id, - chainId: props.contract.chain.id, - ...(params.type === "error" - ? { - errorMessage: params.errorMessage, - } - : {}), - }); - } - const handleSubmit = form.handleSubmit(async (data) => { try { - trackAssetBuy({ - type: "attempt", - }); - if (!account) { return toast.error("No account detected"); } @@ -145,11 +112,15 @@ export function BuyEditionDrop(props: BuyEditionDropProps) { await approveTxPromise; } catch (err) { const errorMessage = parseError(err); - trackAssetBuy({ - type: "error", - errorMessage: - typeof errorMessage === "string" ? errorMessage : "Unknown error", + + reportAssetBuyFailed({ + chainId: props.contract.chain.id, + contractType: "DropERC1155", + assetType: "nft", + error: errorMessage, }); + + console.error(errorMessage); return; } } @@ -170,8 +141,10 @@ export function BuyEditionDrop(props: BuyEditionDropProps) { try { await claimTxPromise; - trackAssetBuy({ - type: "success", + reportAssetBuySuccessful({ + chainId: props.contract.chain.id, + contractType: "DropERC1155", + assetType: "nft", }); props.onSuccess?.(); @@ -180,24 +153,31 @@ export function BuyEditionDrop(props: BuyEditionDropProps) { queryKey: [ASSET_PAGE_ERC1155_QUERIES_ROOT_KEY], }); } catch (err) { + console.error(err); const errorMessage = parseError(err); - trackAssetBuy({ - type: "error", - errorMessage: - typeof errorMessage === "string" ? errorMessage : "Unknown error", + + reportAssetBuyFailed({ + chainId: props.contract.chain.id, + contractType: "DropERC1155", + assetType: "nft", + error: errorMessage, }); + return; } } catch (err) { + console.error(err); const errorMessage = parseError(err); + toast.error("Failed to buy NFTs", { - description: - typeof errorMessage === "string" ? errorMessage : undefined, + description: errorMessage, }); - trackAssetBuy({ - type: "error", - errorMessage: - typeof errorMessage === "string" ? errorMessage : "Unknown error", + + reportAssetBuyFailed({ + chainId: props.contract.chain.id, + contractType: "DropERC1155", + assetType: "nft", + error: errorMessage, }); } }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/buy-nft-drop/buy-nft-drop.client.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/buy-nft-drop/buy-nft-drop.client.tsx index febc4ae11fc..25efe376fe8 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/buy-nft-drop/buy-nft-drop.client.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/public-pages/nft/overview/buy-nft-drop/buy-nft-drop.client.tsx @@ -1,16 +1,15 @@ "use client"; -import { useTrack } from "hooks/analytics/useTrack"; +import { + reportAssetBuyFailed, + reportAssetBuySuccessful, +} from "@/analytics/report"; import { toast } from "sonner"; import type { ThirdwebContract } from "thirdweb"; import type { NFT } from "thirdweb"; import type { ChainMetadata } from "thirdweb/chains"; import { getApprovalForTransaction } from "thirdweb/extensions/erc20"; import { claimTo, getNFT } from "thirdweb/extensions/erc721"; -import { - useActiveAccount, - useActiveWallet, - useSendAndConfirmTransaction, -} from "thirdweb/react"; +import { useActiveAccount, useSendAndConfirmTransaction } from "thirdweb/react"; import { getClaimParams } from "thirdweb/utils"; import { parseError } from "utils/errorParser"; import { getCurrencyMeta } from "../../../erc20/_utils/getCurrencyMeta"; @@ -29,45 +28,12 @@ export type BuyNFTDropProps = Omit< >; export function BuyNFTDrop(props: BuyNFTDropProps) { - const trackEvent = useTrack(); const sendAndConfirmTx = useSendAndConfirmTransaction(); const account = useActiveAccount(); - const activeWallet = useActiveWallet(); - - function trackAssetBuy( - params: - | { - type: "attempt" | "success"; - } - | { - type: "error"; - errorMessage: string; - }, - ) { - trackEvent({ - category: "asset", - action: "buy", - label: params.type, - contractType: "NFTCollection", - ercType: "erc721", - accountAddress: account?.address, - walletId: activeWallet?.id, - chainId: props.contract.chain.id, - ...(params.type === "error" - ? { - errorMessage: params.errorMessage, - } - : {}), - }); - } const handleSubmit = async (form: BuyNFTDropForm) => { const nftAmountToClaim = form.getValues("amount"); try { - trackAssetBuy({ - type: "attempt", - }); - if (!account) { return toast.error("No account detected"); } @@ -103,12 +69,16 @@ export function BuyNFTDrop(props: BuyNFTDropProps) { try { await approveTxPromise; } catch (err) { + console.error(err); const errorMessage = parseError(err); - trackAssetBuy({ - type: "error", - errorMessage: - typeof errorMessage === "string" ? errorMessage : "Unknown error", + + reportAssetBuyFailed({ + chainId: props.contract.chain.id, + contractType: "DropERC721", + assetType: "nft", + error: errorMessage, }); + return; } } @@ -129,30 +99,38 @@ export function BuyNFTDrop(props: BuyNFTDropProps) { try { await claimTxPromise; - trackAssetBuy({ - type: "success", + reportAssetBuySuccessful({ + chainId: props.contract.chain.id, + contractType: "DropERC721", + assetType: "nft", }); props.onSuccess?.(); } catch (err) { + console.error(err); const errorMessage = parseError(err); - trackAssetBuy({ - type: "error", - errorMessage: - typeof errorMessage === "string" ? errorMessage : "Unknown error", + + reportAssetBuyFailed({ + chainId: props.contract.chain.id, + contractType: "DropERC721", + assetType: "nft", + error: errorMessage, }); + return; } } catch (err) { + console.error(err); const errorMessage = parseError(err); + toast.error("Failed to buy NFTs", { - description: - typeof errorMessage === "string" ? errorMessage : undefined, + description: errorMessage, }); - trackAssetBuy({ - type: "error", - errorMessage: - typeof errorMessage === "string" ? errorMessage : "Unknown error", + reportAssetBuyFailed({ + chainId: props.contract.chain.id, + contractType: "DropERC721", + assetType: "nft", + error: errorMessage, }); } }; diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/metadata.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/metadata.tsx index eb452f6a9d8..bd35e80ddd4 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/metadata.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/metadata.tsx @@ -13,7 +13,6 @@ import type { ExtensionDetectedState } from "components/buttons/ExtensionDetecte import { TransactionButton } from "components/buttons/TransactionButton"; import { FileInput } from "components/shared/FileInput"; import { CommonContractSchema } from "constants/schemas"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { PlusIcon, Trash2Icon } from "lucide-react"; import { useMemo } from "react"; @@ -70,7 +69,6 @@ export const SettingsMetadata = ({ detectedState: ExtensionDetectedState; isLoggedIn: boolean; }) => { - const trackEvent = useTrack(); const metadata = useReadContract(getContractMetadata, { contract }); const sendTransaction = useSendAndConfirmTransaction(); @@ -167,12 +165,6 @@ export const SettingsMetadata = ({ {}, ); - trackEvent({ - category: "settings", - action: "set-metadata", - label: "attempt", - }); - const tx = setContractMetadata({ contract, ...data, @@ -181,20 +173,9 @@ export const SettingsMetadata = ({ sendTransaction.mutate(tx, { onSuccess: () => { - trackEvent({ - category: "settings", - action: "set-metadata", - label: "success", - }); onSuccess(); }, onError: (error) => { - trackEvent({ - category: "settings", - action: "set-metadata", - label: "error", - error, - }); onError(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/platform-fees.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/platform-fees.tsx index 60cf9102e7d..b820b96154a 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/platform-fees.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/platform-fees.tsx @@ -7,7 +7,6 @@ import { TransactionButton } from "components/buttons/TransactionButton"; import { BasisPointsInput } from "components/inputs/BasisPointsInput"; import { AddressOrEnsSchema, BasisPointsSchema } from "constants/schemas"; import { SolidityInput } from "contract-ui/components/solidity-inputs"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { useForm } from "react-hook-form"; import type { ThirdwebContract } from "thirdweb"; @@ -51,7 +50,6 @@ export const SettingsPlatformFees = ({ detectedState: ExtensionDetectedState; isLoggedIn: boolean; }) => { - const trackEvent = useTrack(); const address = useActiveAccount()?.address; const sendAndConfirmTx = useSendAndConfirmTransaction(); const platformFeesQuery = useReadContract(getPlatformFeeInfo, { contract }); @@ -80,11 +78,6 @@ export const SettingsPlatformFees = ({ { - trackEvent({ - category: "settings", - action: "set-platform-fees", - label: "attempt", - }); const transaction = setPlatformFeeInfo({ contract, platformFeeRecipient: data.platform_fee_recipient, @@ -92,21 +85,11 @@ export const SettingsPlatformFees = ({ }); sendAndConfirmTx.mutate(transaction, { onSuccess: () => { - trackEvent({ - category: "settings", - action: "set-platform-fees", - label: "success", - }); form.reset(data); onSuccess(); }, onError: (error) => { - trackEvent({ - category: "settings", - action: "set-platform-fees", - label: "error", - error, - }); + console.error(error); onError(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/primary-sale.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/primary-sale.tsx index 0706daba67a..38cf195bbc7 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/primary-sale.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/primary-sale.tsx @@ -6,7 +6,7 @@ import type { ExtensionDetectedState } from "components/buttons/ExtensionDetecte import { TransactionButton } from "components/buttons/TransactionButton"; import { AddressOrEnsSchema } from "constants/schemas"; import { SolidityInput } from "contract-ui/components/solidity-inputs"; -import { useTrack } from "hooks/analytics/useTrack"; + import { useTxNotifications } from "hooks/useTxNotifications"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; @@ -44,7 +44,7 @@ export const SettingsPrimarySale = ({ isLoggedIn: boolean; }) => { const address = useActiveAccount()?.address; - const trackEvent = useTrack(); + const query = useReadContract(primarySaleRecipient, { contract, }); @@ -72,11 +72,6 @@ export const SettingsPrimarySale = ({ { - trackEvent({ - category: "settings", - action: "set-primary-sale", - label: "attempt", - }); const saleRecipient = d.primary_sale_recipient; if (!saleRecipient) { return toast.error( @@ -90,21 +85,11 @@ export const SettingsPrimarySale = ({ // if we switch back to mutateAsync then *need* to catch errors mutation.mutate(transaction, { onSuccess: () => { - trackEvent({ - category: "settings", - action: "set-primary-sale", - label: "success", - }); form.reset({ primary_sale_recipient: saleRecipient }); onSuccess(); }, onError: (error) => { - trackEvent({ - category: "settings", - action: "set-primary-sale", - label: "error", - error, - }); + console.error(error); onError(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/royalties.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/royalties.tsx index df69e74c7cb..b9db6020636 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/royalties.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/settings/components/royalties.tsx @@ -7,7 +7,6 @@ import { TransactionButton } from "components/buttons/TransactionButton"; import { BasisPointsInput } from "components/inputs/BasisPointsInput"; import { AddressOrEnsSchema, BasisPointsSchema } from "constants/schemas"; import { SolidityInput } from "contract-ui/components/solidity-inputs"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { useForm } from "react-hook-form"; import type { ThirdwebContract } from "thirdweb"; @@ -65,7 +64,6 @@ export const SettingsRoyalties = ({ detectedState: ExtensionDetectedState; isLoggedIn: boolean; }) => { - const trackEvent = useTrack(); const query = useReadContract(getDefaultRoyaltyInfo, { contract, }); @@ -93,11 +91,6 @@ export const SettingsRoyalties = ({ { - trackEvent({ - category: "settings", - action: "set-royalty", - label: "attempt", - }); const transaction = setDefaultRoyaltyInfo({ contract, royaltyRecipient: d.fee_recipient, @@ -105,21 +98,11 @@ export const SettingsRoyalties = ({ }); mutation.mutate(transaction, { onSuccess: () => { - trackEvent({ - category: "settings", - action: "set-royalty", - label: "success", - }); form.reset(d); onSuccess(); }, onError: (error) => { - trackEvent({ - category: "settings", - action: "set-royalty", - label: "error", - error, - }); + console.error(error); onError(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/split/components/distribute-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/split/components/distribute-button.tsx index 88a5ab2b4f7..78d398a81c4 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/split/components/distribute-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/split/components/distribute-button.tsx @@ -3,7 +3,7 @@ import { Button } from "@/components/ui/button"; import { useSplitDistributeFunds } from "@3rdweb-sdk/react/hooks/useSplit"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; + import { useTxNotifications } from "hooks/useTxNotifications"; import { useMemo } from "react"; import type { ThirdwebContract } from "thirdweb"; @@ -25,7 +25,6 @@ export const DistributeButton: React.FC = ({ isLoggedIn, ...restButtonProps }) => { - const trackEvent = useTrack(); const validBalances = balances.filter( (item) => item.balance !== "0" && item.balance !== "0.0", ); @@ -55,19 +54,9 @@ export const DistributeButton: React.FC = ({ mutation.mutate(undefined, { onSuccess: () => { onSuccess(); - trackEvent({ - category: "split", - action: "distribute", - label: "success", - }); }, onError: (error) => { - trackEvent({ - category: "split", - action: "distribute", - label: "error", - error, - }); + console.error(error); onError(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/airdrop-form.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/airdrop-form.tsx index 145b38ad4c3..c9fac250ea1 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/airdrop-form.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/airdrop-form.tsx @@ -1,7 +1,6 @@ "use client"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { CircleCheckIcon, UploadIcon } from "lucide-react"; import { type Dispatch, type SetStateAction, useState } from "react"; @@ -29,7 +28,7 @@ export const TokenAirdropForm: React.FC = ({ }>({ defaultValues: { addresses: [] }, }); - const trackEvent = useTrack(); + const sendTransaction = useSendAndConfirmTransaction(); const addresses = watch("addresses"); const [airdropFormOpen, setAirdropFormOpen] = useState(false); @@ -48,12 +47,6 @@ export const TokenAirdropForm: React.FC = ({ { try { - trackEvent({ - category: "token", - action: "airdrop", - label: "attempt", - contractAddress: contract.address, - }); const tx = transferBatch({ contract, batch: data.addresses @@ -65,25 +58,12 @@ export const TokenAirdropForm: React.FC = ({ }); await sendTransaction.mutateAsync(tx, { onSuccess: () => { - trackEvent({ - category: "token", - action: "airdrop", - label: "success", - contract_address: contract.address, - }); // Close the sheet/modal on success if (toggle) { toggle(false); } }, onError: (error) => { - trackEvent({ - category: "token", - action: "airdrop", - label: "success", - contract_address: contract.address, - error, - }); console.error(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/burn-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/burn-button.tsx index 88571fb0c4e..5072eba3d2e 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/burn-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/burn-button.tsx @@ -11,7 +11,6 @@ import { } from "@/components/ui/sheet"; import { FormControl, Input } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { FlameIcon } from "lucide-react"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -53,7 +52,6 @@ export const TokenBurnButton: React.FC = ({ const hasBalance = tokenBalanceQuery.data && tokenBalanceQuery.data > 0n; const [open, setOpen] = useState(false); const sendConfirmation = useSendAndConfirmTransaction(); - const trackEvent = useTrack(); const form = useForm({ defaultValues: { amount: "0" } }); const decimalsQuery = useReadContract(ERC20Ext.decimals, { contract }); @@ -107,12 +105,6 @@ export const TokenBurnButton: React.FC = ({ disabled={!form.formState.isDirty} onClick={form.handleSubmit((data) => { if (address) { - trackEvent({ - category: "token", - action: "burn", - label: "attempt", - }); - // TODO: burn should be updated to take amount / amountWei (v6?) const tx = ERC20Ext.burn({ contract, @@ -128,21 +120,10 @@ export const TokenBurnButton: React.FC = ({ const promise = sendConfirmation.mutateAsync(tx, { onSuccess: () => { - trackEvent({ - category: "token", - action: "burn", - label: "success", - }); form.reset({ amount: "0" }); setOpen(false); }, onError: (error) => { - trackEvent({ - category: "token", - action: "burn", - label: "error", - error, - }); console.error(error); }, }); diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/claim-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/claim-button.tsx index c3801de44d5..1cc58ca872b 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/claim-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/claim-button.tsx @@ -11,7 +11,7 @@ import { } from "@/components/ui/sheet"; import { FormControl, Input } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; + import { useTxNotifications } from "hooks/useTxNotifications"; import { GemIcon } from "lucide-react"; import { useState } from "react"; @@ -40,7 +40,6 @@ export const TokenClaimButton: React.FC = ({ }) => { const [open, setOpen] = useState(false); const sendAndConfirmTransaction = useSendAndConfirmTransaction(); - const trackEvent = useTrack(); const account = useActiveAccount(); const form = useForm({ defaultValues: { amount: "0", to: account?.address }, @@ -107,11 +106,7 @@ export const TokenClaimButton: React.FC = ({ "Need to specify an address to receive tokens", ); } - trackEvent({ - category: "token", - action: "claim", - label: "attempt", - }); + if (!account) { return toast.error("No account detected"); } @@ -147,21 +142,10 @@ export const TokenClaimButton: React.FC = ({ await sendAndConfirmTransaction.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "token", - action: "claim", - label: "success", - }); form.reset({ amount: "0", to: account?.address }); setOpen(false); }, onError: (error) => { - trackEvent({ - category: "token", - action: "claim", - label: "error", - error, - }); console.error(error); }, }); @@ -170,12 +154,6 @@ export const TokenClaimButton: React.FC = ({ } catch (error) { console.error(error); claimTokensNotifications.onError(error); - trackEvent({ - category: "token", - action: "claim", - label: "error", - error, - }); } })} > diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/mint-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/mint-button.tsx index 748ca7f68a5..551d14df178 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/mint-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/mint-button.tsx @@ -12,7 +12,6 @@ import { import { MinterOnly } from "@3rdweb-sdk/react/components/roles/minter-only"; import { FormControl, Input } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; -import { useTrack } from "hooks/analytics/useTrack"; import { PlusIcon } from "lucide-react"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -47,7 +46,6 @@ export const TokenMintButton: React.FC = ({ contract, }); const sendAndConfirmTransaction = useSendAndConfirmTransaction(); - const trackEvent = useTrack(); const form = useForm({ defaultValues: { amount: "0" } }); return ( @@ -70,11 +68,6 @@ export const TokenMintButton: React.FC = ({ if (!address) { return toast.error("No wallet connected"); } - trackEvent({ - category: "token", - action: "mint", - label: "attempt", - }); const transaction = ERC20Ext.mintTo({ contract, amount: d.amount, @@ -84,21 +77,10 @@ export const TokenMintButton: React.FC = ({ transaction, { onSuccess: () => { - trackEvent({ - category: "token", - action: "mint", - label: "success", - }); form.reset({ amount: "0" }); setOpen(false); }, onError: (error) => { - trackEvent({ - category: "token", - action: "mint", - label: "error", - error, - }); console.error(error); }, }, diff --git a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/transfer-button.tsx b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/transfer-button.tsx index d2b2d2ea336..5000213892e 100644 --- a/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/transfer-button.tsx +++ b/apps/dashboard/src/app/(app)/(dashboard)/(chain)/[chain_id]/[contractAddress]/tokens/components/transfer-button.tsx @@ -12,7 +12,6 @@ import { import { FormControl, Input } from "@chakra-ui/react"; import { TransactionButton } from "components/buttons/TransactionButton"; import { SolidityInput } from "contract-ui/components/solidity-inputs"; -import { useTrack } from "hooks/analytics/useTrack"; import { SendIcon } from "lucide-react"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -44,7 +43,6 @@ export const TokenTransferButton: React.FC = ({ address: address || "", queryOptions: { enabled: !!address }, }); - const trackEvent = useTrack(); const form = useForm({ defaultValues: { amount: "0", to: "" } }); const hasBalance = tokenBalanceQuery.data && tokenBalanceQuery.data > 0n; const decimalsQuery = useReadContract(ERC20Ext.decimals, { contract }); @@ -110,11 +108,6 @@ export const TokenTransferButton: React.FC = ({ type="submit" disabled={!form.formState.isDirty} onClick={form.handleSubmit((d) => { - trackEvent({ - category: "token", - action: "transfer", - label: "attempt", - }); const transaction = ERC20Ext.transfer({ contract, amount: d.amount, @@ -122,21 +115,10 @@ export const TokenTransferButton: React.FC = ({ }); const promise = sendConfirmation.mutateAsync(transaction, { onSuccess: () => { - trackEvent({ - category: "token", - action: "transfer", - label: "success", - }); form.reset({ amount: "0", to: "" }); setOpen(false); }, onError: (error) => { - trackEvent({ - category: "token", - action: "transfer", - label: "error", - error, - }); console.error(error); }, }); diff --git a/apps/dashboard/src/app/(app)/account/contracts/DeployedContractsPageHeader.tsx b/apps/dashboard/src/app/(app)/account/contracts/DeployedContractsPageHeader.tsx index d506605385a..426efa6e74b 100644 --- a/apps/dashboard/src/app/(app)/account/contracts/DeployedContractsPageHeader.tsx +++ b/apps/dashboard/src/app/(app)/account/contracts/DeployedContractsPageHeader.tsx @@ -2,7 +2,7 @@ import { Button } from "@/components/ui/button"; import { ImportModal } from "components/contract-components/import-contract/modal"; -import { useTrack } from "hooks/analytics/useTrack"; + import { DownloadIcon, PlusIcon } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; @@ -14,7 +14,6 @@ export function DeployedContractsPageHeader(props: { client: ThirdwebClient; }) { const [importModalOpen, setImportModalOpen] = useState(false); - const trackEvent = useTrack(); return (
@@ -40,11 +39,6 @@ export function DeployedContractsPageHeader(props: { className="gap-2 bg-card" variant="outline" onClick={() => { - trackEvent({ - action: "click", - category: "contracts", - label: "import-contract", - }); setImportModalOpen(true); }} > diff --git a/apps/dashboard/src/app/(app)/account/contracts/_components/DeployViaCLIOrImportCard.tsx b/apps/dashboard/src/app/(app)/account/contracts/_components/DeployViaCLIOrImportCard.tsx index 4c23bb47209..b59d2c7d9aa 100644 --- a/apps/dashboard/src/app/(app)/account/contracts/_components/DeployViaCLIOrImportCard.tsx +++ b/apps/dashboard/src/app/(app)/account/contracts/_components/DeployViaCLIOrImportCard.tsx @@ -2,7 +2,7 @@ import { Button } from "@/components/ui/button"; import { ImportModal } from "components/contract-components/import-contract/modal"; -import { useTrack } from "hooks/analytics/useTrack"; + import { ArrowUpRightIcon, DownloadIcon } from "lucide-react"; import Link from "next/link"; import { useState } from "react"; @@ -13,7 +13,6 @@ export function DeployViaCLIOrImportCard(props: { projectId: string; client: ThirdwebClient; }) { - const trackEvent = useTrack(); const [importModalOpen, setImportModalOpen] = useState(false); return ( @@ -58,11 +57,6 @@ export function DeployViaCLIOrImportCard(props: { className="gap-2 bg-background" onClick={() => { setImportModalOpen(true); - trackEvent({ - category: "contracts-banner", - action: "click", - label: "import-contract", - }); }} > diff --git a/apps/dashboard/src/app/(app)/login/onboarding/LinkWalletPrompt/LinkWalletPrompt.stories.tsx b/apps/dashboard/src/app/(app)/login/onboarding/LinkWalletPrompt/LinkWalletPrompt.stories.tsx index ae272cdbd95..d17c254ecb2 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/LinkWalletPrompt/LinkWalletPrompt.stories.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/LinkWalletPrompt/LinkWalletPrompt.stories.tsx @@ -54,9 +54,6 @@ function Story(props: { onBack={() => { storybookLog("onBack"); }} - trackEvent={(params) => { - storybookLog("trackEvent", params); - }} accountAddress="0x1234567890123456789012345678901234567890" /> diff --git a/apps/dashboard/src/app/(app)/login/onboarding/LinkWalletPrompt/LinkWalletPrompt.tsx b/apps/dashboard/src/app/(app)/login/onboarding/LinkWalletPrompt/LinkWalletPrompt.tsx index 080e5e968f6..37df64b86d8 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/LinkWalletPrompt/LinkWalletPrompt.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/LinkWalletPrompt/LinkWalletPrompt.tsx @@ -4,7 +4,6 @@ import { Spinner } from "@/components/ui/Spinner/Spinner"; import { UnderlineLink } from "@/components/ui/UnderlineLink"; import { Button } from "@/components/ui/button"; import { useMutation } from "@tanstack/react-query"; -import type { TrackingParams } from "hooks/analytics/useTrack"; import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react"; import { toast } from "sonner"; import { shortenString } from "utils/usedapp-external"; @@ -14,7 +13,6 @@ export function LinkWalletPrompt(props: { accountAddress: string; onBack: () => void; requestLinkWallet: (email: string) => Promise; - trackEvent: (params: TrackingParams) => void; onLinkWalletRequestSent: () => void; }) { const requestLinkWallet = useMutation({ @@ -22,35 +20,14 @@ export function LinkWalletPrompt(props: { }); function handleLinkWalletRequest() { - props.trackEvent({ - category: "account", - action: "linkWallet", - label: "attempt", - data: { - email: props.email, - }, - }); - requestLinkWallet.mutate(props.email, { - onSuccess: (data) => { + onSuccess: () => { props.onLinkWalletRequestSent(); - props.trackEvent({ - category: "account", - action: "linkWallet", - label: "success", - data, - }); }, onError: (err) => { const error = err as Error; console.error(error); toast.error("Failed to send link wallet request"); - props.trackEvent({ - category: "account", - action: "linkWallet", - label: "error", - error, - }); }, }); } diff --git a/apps/dashboard/src/app/(app)/login/onboarding/LoginOrSignup/LoginOrSignup.stories.tsx b/apps/dashboard/src/app/(app)/login/onboarding/LoginOrSignup/LoginOrSignup.stories.tsx index f4e43504da6..938dc9b06aa 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/LoginOrSignup/LoginOrSignup.stories.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/LoginOrSignup/LoginOrSignup.stories.tsx @@ -62,9 +62,6 @@ function Story(props: { throw new Error("email address already exists"); } }} - trackEvent={(params) => { - storybookLog("trackEvent", params); - }} /> ); diff --git a/apps/dashboard/src/app/(app)/login/onboarding/LoginOrSignup/LoginOrSignup.tsx b/apps/dashboard/src/app/(app)/login/onboarding/LoginOrSignup/LoginOrSignup.tsx index 6b7f49381a5..1aa5e6b8362 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/LoginOrSignup/LoginOrSignup.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/LoginOrSignup/LoginOrSignup.tsx @@ -8,7 +8,6 @@ import { Input } from "@/components/ui/input"; import { TabButtons } from "@/components/ui/tabs"; import { zodResolver } from "@hookform/resolvers/zod"; import { useMutation } from "@tanstack/react-query"; -import type { TrackingParams } from "hooks/analytics/useTrack"; import { ArrowRightIcon } from "lucide-react"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -30,7 +29,6 @@ export function LoginOrSignup(props: { subscribeToUpdates?: true; name?: string; }) => Promise; - trackEvent: (params: TrackingParams) => void; }) { const [tab, setTab] = useState<"signup" | "login">("signup"); const loginOrSignup = useMutation({ @@ -43,17 +41,11 @@ export function LoginOrSignup(props: { name?: string; }) { loginOrSignup.mutate(values, { - onSuccess: (data) => { + onSuccess: () => { props.onRequestSent({ email: values.email, isExistingEmail: false, }); - props.trackEvent({ - category: "onboarding", - action: "update", - label: "success", - data, - }); }, onError: (error) => { if (error?.message.match(/email address already exists/)) { @@ -69,13 +61,6 @@ export function LoginOrSignup(props: { } console.error(error); - props.trackEvent({ - category: "account", - action: "update", - label: "error", - error: error.message, - fromOnboarding: true, - }); }, }); } diff --git a/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.stories.tsx b/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.stories.tsx index 54de6b6fb76..2b685ad0eaa 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.stories.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.stories.tsx @@ -52,7 +52,6 @@ function Story(props: { > { await new Promise((resolve) => setTimeout(resolve, 1000)); @@ -76,9 +75,6 @@ function Story(props: { onBack={() => { storybookLog("onBack"); }} - trackEvent={(params) => { - storybookLog("trackEvent", params); - }} /> ); diff --git a/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.tsx b/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.tsx index 43d902dce9f..1076691574a 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/VerifyEmail/VerifyEmail.tsx @@ -10,7 +10,6 @@ import { cn } from "@/lib/utils"; import type { Account } from "@3rdweb-sdk/react/hooks/useApi"; import { zodResolver } from "@hookform/resolvers/zod"; import { useMutation } from "@tanstack/react-query"; -import type { TrackingParams } from "hooks/analytics/useTrack"; import { REGEXP_ONLY_DIGITS_AND_CHARS } from "input-otp"; import { ArrowLeftIcon, RotateCcwIcon } from "lucide-react"; import { useForm } from "react-hook-form"; @@ -28,10 +27,8 @@ type VerifyEmailProps = { confirmationToken: string; }) => Promise<{ account: Account }>; resendConfirmationEmail: () => Promise; - trackEvent: (params: TrackingParams) => void; accountAddress: string; title: string; - trackingAction: string; }; export function VerifyEmail(props: VerifyEmailProps) { @@ -51,30 +48,13 @@ export function VerifyEmail(props: VerifyEmailProps) { }); const handleSubmit = form.handleSubmit((values) => { - props.trackEvent({ - category: "account", - action: props.trackingAction, - label: "attempt", - }); - verifyEmail.mutate(values, { onSuccess: (response) => { props.onEmailConfirmed(response); - props.trackEvent({ - category: "account", - action: props.trackingAction, - label: "success", - }); }, onError: (error) => { console.error(error); toast.error("Invalid confirmation code"); - props.trackEvent({ - category: "account", - action: props.trackingAction, - label: "error", - error: error.message, - }); }, }); }); @@ -83,29 +63,13 @@ export function VerifyEmail(props: VerifyEmailProps) { form.setValue("confirmationToken", ""); verifyEmail.reset(); - props.trackEvent({ - category: "account", - action: "resendEmailConfirmation", - label: "attempt", - }); - resendConfirmationEmail.mutate(undefined, { onSuccess: () => { toast.success("Verification code sent"); - props.trackEvent({ - category: "account", - action: "resendEmailConfirmation", - label: "success", - }); }, onError: (error) => { + console.error(error); toast.error("Failed to send verification code"); - props.trackEvent({ - category: "account", - action: "resendEmailConfirmation", - label: "error", - error, - }); }, }); } @@ -195,23 +159,11 @@ export function VerifyEmail(props: VerifyEmailProps) { export function LinkWalletVerifyEmail( props: Omit, ) { - return ( - - ); + return ; } export function SignupVerifyEmail( props: Omit, ) { - return ( - - ); + return ; } diff --git a/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding-ui.tsx b/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding-ui.tsx index 69b622924f4..1b3e0dccba5 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding-ui.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding-ui.tsx @@ -1,6 +1,6 @@ "use client"; import type { Account } from "@3rdweb-sdk/react/hooks/useApi"; -import type { TrackingParams } from "hooks/analytics/useTrack"; + import { useState } from "react"; import { LinkWalletPrompt } from "./LinkWalletPrompt/LinkWalletPrompt"; import { LoginOrSignup } from "./LoginOrSignup/LoginOrSignup"; @@ -27,7 +27,6 @@ type AccountOnboardingScreen = type AccountOnboardingProps = { onComplete: (param: { account: Account }) => void; accountAddress: string; - trackEvent: (params: TrackingParams) => void; verifyEmail: (params: { confirmationToken: string; }) => Promise<{ account: Account }>; @@ -56,7 +55,6 @@ export function AccountOnboardingUI(props: AccountOnboardingProps) { {screen.id === "login-or-signup" && ( { if (params.isExistingEmail) { setScreen({ @@ -79,7 +77,6 @@ export function AccountOnboardingUI(props: AccountOnboardingProps) { { setScreen({ id: "link-wallet-verify-email", @@ -97,7 +94,6 @@ export function AccountOnboardingUI(props: AccountOnboardingProps) { accountAddress={props.accountAddress} verifyEmail={props.verifyEmail} resendConfirmationEmail={props.resendEmailConfirmation} - trackEvent={props.trackEvent} onEmailConfirmed={props.onComplete} onBack={() => setScreen(screen.backScreen)} email={screen.email} @@ -109,7 +105,6 @@ export function AccountOnboardingUI(props: AccountOnboardingProps) { accountAddress={props.accountAddress} verifyEmail={props.verifyEmail} resendConfirmationEmail={props.resendEmailConfirmation} - trackEvent={props.trackEvent} onEmailConfirmed={props.onComplete} onBack={() => setScreen(screen.backScreen)} email={screen.email} diff --git a/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding.stories.tsx b/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding.stories.tsx index 0af63467eb1..7dd68707f99 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding.stories.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding.stories.tsx @@ -47,9 +47,6 @@ function Story(props: { storybookLog("onComplete"); }} accountAddress="" - trackEvent={(params) => { - storybookLog("trackEvent", params); - }} loginOrSignup={async () => { await new Promise((resolve) => setTimeout(resolve, 1000)); if (props.loginOrSignupType === "error-email-exists") { diff --git a/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding.tsx b/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding.tsx index 6eaa4dbcf00..41e1b69aac6 100644 --- a/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding.tsx +++ b/apps/dashboard/src/app/(app)/login/onboarding/account-onboarding.tsx @@ -5,7 +5,6 @@ import { updateAccountClient, verifyEmailClient, } from "@3rdweb-sdk/react/hooks/useApi"; -import { useTrack } from "hooks/analytics/useTrack"; import { useActiveWallet } from "thirdweb/react"; import { useDisconnect } from "thirdweb/react"; import { doLogout } from "../auth-actions"; @@ -16,7 +15,6 @@ function AccountOnboarding(props: { onLogout: () => void; accountAddress: string; }) { - const trackEvent = useTrack(); const activeWallet = useActiveWallet(); const { disconnect } = useDisconnect(); return ( @@ -37,7 +35,6 @@ function AccountOnboarding(props: { resendEmailConfirmation={async () => { await resendEmailClient(); }} - trackEvent={trackEvent} requestLinkWallet={async (email) => { await updateAccountClient({ email, diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/invite-team-members-button.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/invite-team-members-button.tsx index f9da4f417fa..5e450b57652 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/invite-team-members-button.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/(team)/_components/invite-team-members-button.tsx @@ -1,25 +1,12 @@ "use client"; import { Button } from "@/components/ui/button"; -import { useTrack } from "hooks/analytics/useTrack"; import { UserPlusIcon } from "lucide-react"; import Link from "next/link"; export function InviteTeamMembersButton(props: { teamSlug: string }) { - const trackEvent = useTrack(); return ( -
@@ -96,6 +98,7 @@ function ImportForm(props: { projectId: string; client: ThirdwebClient; type: "contract" | "asset"; + onSuccess?: () => void; }) { const router = useDashboardRouter(); const activeChainId = useActiveWalletChain()?.id; @@ -162,6 +165,7 @@ function ImportForm(props: { onSuccess: () => { router.refresh(); toast.success("Contract imported successfully"); + props.onSuccess?.(); }, onError: (err) => { console.error(err); diff --git a/apps/dashboard/src/components/embedded-wallets/Configure/InAppWalletSettingsUI.stories.tsx b/apps/dashboard/src/components/embedded-wallets/Configure/InAppWalletSettingsUI.stories.tsx index 2f9fb64da72..ee01f00bcde 100644 --- a/apps/dashboard/src/components/embedded-wallets/Configure/InAppWalletSettingsUI.stories.tsx +++ b/apps/dashboard/src/components/embedded-wallets/Configure/InAppWalletSettingsUI.stories.tsx @@ -64,7 +64,6 @@ function Variants(props: { }} teamSlug="bar" isUpdating={false} - trackingCategory="foo" updateApiKey={() => {}} smsCountryTiers={{ // scaffold some countries to play around with the UI diff --git a/apps/dashboard/src/components/embedded-wallets/Configure/index.tsx b/apps/dashboard/src/components/embedded-wallets/Configure/index.tsx index 8d3f8751ccb..88443922b12 100644 --- a/apps/dashboard/src/components/embedded-wallets/Configure/index.tsx +++ b/apps/dashboard/src/components/embedded-wallets/Configure/index.tsx @@ -31,7 +31,6 @@ import { type ApiKeyEmbeddedWalletsValidationSchema, apiKeyEmbeddedWalletsValidationSchema, } from "components/settings/ApiKeys/validations"; -import { useTrack } from "hooks/analytics/useTrack"; import { CircleAlertIcon, PlusIcon, Trash2Icon } from "lucide-react"; import Link from "next/link"; import type React from "react"; @@ -46,7 +45,6 @@ import { FileInput } from "../../shared/FileInput"; import CountrySelector from "./sms-country-select/country-selector"; type InAppWalletSettingsPageProps = { - trackingCategory: string; project: Project; teamId: string; teamSlug: string; @@ -74,38 +72,14 @@ export function InAppWalletSettingsPage(props: InAppWalletSettingsPageProps) { }, }); - const { trackingCategory } = props; - const trackEvent = useTrack(); - - function handleUpdateProject( - projectValues: Partial, - trackingData: UpdateAPIKeyTrackingData, - ) { - trackEvent({ - category: trackingCategory, - action: "configuration-update", - label: "attempt", - }); - + function handleUpdateProject(projectValues: Partial) { updateProject.mutate(projectValues, { onSuccess: () => { toast.success("In-App Wallet API Key configuration updated"); - trackEvent({ - category: trackingCategory, - action: "configuration-update", - label: "success", - data: trackingData, - }); }, onError: (err) => { toast.error("Failed to update an API Key"); console.error(err); - trackEvent({ - category: trackingCategory, - action: "configuration-update", - label: "error", - error: err, - }); }, }); } diff --git a/apps/dashboard/src/components/onboarding/ApplyForOpCreditsForm.tsx b/apps/dashboard/src/components/onboarding/ApplyForOpCreditsForm.tsx index b1d6ad4b05f..21f8570229b 100644 --- a/apps/dashboard/src/components/onboarding/ApplyForOpCreditsForm.tsx +++ b/apps/dashboard/src/components/onboarding/ApplyForOpCreditsForm.tsx @@ -5,7 +5,6 @@ import { Textarea } from "@/components/ui/textarea"; import type { Account } from "@3rdweb-sdk/react/hooks/useApi"; import { Flex, FormControl } from "@chakra-ui/react"; import { Select as ChakraSelect } from "chakra-react-select"; -import { useTrack } from "hooks/analytics/useTrack"; import { useLocalStorage } from "hooks/useLocalStorage"; import { useTxNotifications } from "hooks/useTxNotifications"; import { useMemo } from "react"; @@ -65,8 +64,6 @@ export const ApplyForOpCreditsForm: React.FC = ({ values: transformedQueryData, }); - const trackEvent = useTrack(); - const { onSuccess, onError } = useTxNotifications( "We have received your application and will notify you if you are selected.", "Something went wrong, please try again.", @@ -84,45 +81,21 @@ export const ApplyForOpCreditsForm: React.FC = ({ value: (data as any)[key], })); - trackEvent({ - category: "op-sponsorship", - action: "apply", - label: "attempt", - }); - try { const response = await applyOpSponsorship({ fields, }); if (!response.ok) { - trackEvent({ - category: "op-sponsorship", - action: "apply", - label: "error", - error: "form-submission-failed", - }); throw new Error("Form submission failed"); } - trackEvent({ - category: "op-sponsorship", - action: "apply", - label: "success", - }); - onSuccess(); onClose(); setHasAppliedForOpGrant(true); form.reset(); } catch (error) { - trackEvent({ - category: "op-sponsorship", - action: "apply", - label: "error", - error: (error as Error).message, - }); onError(error); } })} diff --git a/apps/dashboard/src/components/onboarding/ApplyForOpCreditsModal.tsx b/apps/dashboard/src/components/onboarding/ApplyForOpCreditsModal.tsx index af759a57504..ce4a174ecfc 100644 --- a/apps/dashboard/src/components/onboarding/ApplyForOpCreditsModal.tsx +++ b/apps/dashboard/src/components/onboarding/ApplyForOpCreditsModal.tsx @@ -10,7 +10,6 @@ import { SheetTrigger, } from "@/components/ui/sheet"; import { type Account, accountPlan } from "@3rdweb-sdk/react/hooks/useApi"; -import { useTrack } from "hooks/analytics/useTrack"; import { useLocalStorage } from "hooks/useLocalStorage"; import { ArrowRightIcon, CircleAlertIcon } from "lucide-react"; import { useState } from "react"; @@ -178,7 +177,6 @@ function ApplyOpCreditsButton(props: { validTeamPlan: Team["billingPlan"]; account: Account; }) { - const trackEvent = useTrack(); const { hasAppliedForOpGrant, hasValidPaymentMethod, @@ -195,13 +193,6 @@ function ApplyOpCreditsButton(props: { disabled={!hasValidPaymentMethod || hasAppliedForOpGrant} className="gap-2" size="sm" - onClick={() => { - trackEvent({ - category: "op-sponsorship", - action: "modal", - label: "view-form", - }); - }} > {hasAppliedForOpGrant ? ( "Already applied" diff --git a/apps/dashboard/src/components/pay/PayConfig.tsx b/apps/dashboard/src/components/pay/PayConfig.tsx index a3b7a530a94..22ccd899ce7 100644 --- a/apps/dashboard/src/components/pay/PayConfig.tsx +++ b/apps/dashboard/src/components/pay/PayConfig.tsx @@ -17,7 +17,6 @@ import { type ApiKeyPayConfigValidationSchema, apiKeyPayConfigValidationSchema, } from "components/settings/ApiKeys/validations"; -import { useTrack } from "hooks/analytics/useTrack"; import Link from "next/link"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; @@ -29,8 +28,6 @@ interface PayConfigProps { fees: Fee; } -const TRACKING_CATEGORY = "pay"; - export const PayConfig: React.FC = (props) => { const form = useForm({ resolver: zodResolver(apiKeyPayConfigValidationSchema), @@ -40,8 +37,6 @@ export const PayConfig: React.FC = (props) => { }, }); - const trackEvent = useTrack(); - const updateFeeMutation = useMutation({ mutationFn: async (values: { payoutAddress: string; @@ -66,24 +61,10 @@ export const PayConfig: React.FC = (props) => { { onSuccess: () => { toast.success("Fee sharing updated"); - trackEvent({ - category: TRACKING_CATEGORY, - action: "configuration-update", - label: "success", - data: { - payoutAddress, - }, - }); }, onError: (err) => { toast.error("Failed to update fee sharing"); console.error(err); - trackEvent({ - category: TRACKING_CATEGORY, - action: "configuration-update", - label: "error", - error: err, - }); }, }, ); diff --git a/apps/dashboard/src/components/pay/RouteDiscovery.tsx b/apps/dashboard/src/components/pay/RouteDiscovery.tsx index d455b8c772f..87ef9cfd04b 100644 --- a/apps/dashboard/src/components/pay/RouteDiscovery.tsx +++ b/apps/dashboard/src/components/pay/RouteDiscovery.tsx @@ -17,13 +17,10 @@ import { type RouteDiscoveryValidationSchema, routeDiscoveryValidationSchema, } from "components/settings/ApiKeys/validations"; -import { useTrack } from "hooks/analytics/useTrack"; import { useForm } from "react-hook-form"; import { toast } from "sonner"; import type { ThirdwebClient } from "thirdweb"; -const TRACKING_CATEGORY = "token_discovery"; - export const RouteDiscovery = ({ project, client, @@ -39,8 +36,6 @@ export const RouteDiscovery = ({ }, }); - const trackEvent = useTrack(); - const submitDiscoveryMutation = useMutation({ mutationFn: async (values: { chainId: number; @@ -65,36 +60,17 @@ export const RouteDiscovery = ({ tokenAddress, }, { - onSuccess: (data) => { + onSuccess: () => { toast.success("Token submitted successfully!", { description: "Thank you for your submission. Contact support if your token doesn't appear after some time.", }); - trackEvent({ - category: TRACKING_CATEGORY, - action: "token-discovery-submit", - label: "success", - data: { - tokenAddress, - tokenCount: data?.length || 0, - }, - }); }, onError: () => { toast.error("Token submission failed!", { description: "Please double check the network and token address. If issues persist, please reach out to our support team.", }); - - // Get appropriate error message - const errorMessage = "An unknown error occurred"; - - trackEvent({ - category: TRACKING_CATEGORY, - action: "token-discovery-submit", - label: "error", - error: errorMessage, - }); }, }, ); diff --git a/apps/dashboard/src/components/settings/Account/Billing/CreditsItem.tsx b/apps/dashboard/src/components/settings/Account/Billing/CreditsItem.tsx index b0163c31700..13f5e212196 100644 --- a/apps/dashboard/src/components/settings/Account/Billing/CreditsItem.tsx +++ b/apps/dashboard/src/components/settings/Account/Billing/CreditsItem.tsx @@ -3,7 +3,6 @@ import { Button } from "@/components/ui/button"; import type { Account, BillingCredit } from "@3rdweb-sdk/react/hooks/useApi"; import { ChainIconClient } from "components/icons/ChainIcon"; import { formatDistance } from "date-fns"; -import { useTrack } from "hooks/analytics/useTrack"; import { useLocalStorage } from "hooks/useLocalStorage"; import { CircleAlertIcon } from "lucide-react"; import Image from "next/image"; @@ -28,8 +27,6 @@ export const CreditsItem: React.FC = ({ client, teamSlug, }) => { - const trackEvent = useTrack(); - const [hasAppliedForOpGrant] = useLocalStorage( `appliedForOpGrant-${twAccount.id}`, false, @@ -134,11 +131,6 @@ export const CreditsItem: React.FC = ({ { - trackEvent({ - category: "op-sponsorship", - action: "click", - label: "apply-now", - }); if (onClickApply) { onClickApply(); } diff --git a/apps/dashboard/src/components/settings/Account/Notifications.tsx b/apps/dashboard/src/components/settings/Account/Notifications.tsx index b29a8097a65..ccf34ddce8f 100644 --- a/apps/dashboard/src/components/settings/Account/Notifications.tsx +++ b/apps/dashboard/src/components/settings/Account/Notifications.tsx @@ -6,7 +6,6 @@ import { type Account, useUpdateNotifications, } from "@3rdweb-sdk/react/hooks/useApi"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { useState } from "react"; @@ -20,7 +19,6 @@ export const Notifications: React.FC = ({ account }) => { updates: account.notificationPreferences?.updates || "none", }); - const trackEvent = useTrack(); const updateMutation = useUpdateNotifications(); const { onSuccess, onError } = useTxNotifications( @@ -36,26 +34,8 @@ export const Notifications: React.FC = ({ account }) => { setPreferences(newPreferences); updateMutation.mutate(newPreferences, { - onSuccess: (data) => { - onSuccess(); - - trackEvent({ - category: "notifications", - action: "update", - label: "success", - data, - }); - }, - onError: (error) => { - onError(error); - - trackEvent({ - category: "notifications", - action: "update", - label: "error", - error, - }); - }, + onSuccess, + onError, }); }; diff --git a/apps/dashboard/src/components/settings/ApiKeys/Create/index.tsx b/apps/dashboard/src/components/settings/ApiKeys/Create/index.tsx index 14fc97ece6e..b867f681469 100644 --- a/apps/dashboard/src/components/settings/ApiKeys/Create/index.tsx +++ b/apps/dashboard/src/components/settings/ApiKeys/Create/index.tsx @@ -31,7 +31,6 @@ import { DialogDescription } from "@radix-ui/react-dialog"; import { useMutation } from "@tanstack/react-query"; import type { ProjectService } from "@thirdweb-dev/service-utils"; import { SERVICES } from "@thirdweb-dev/service-utils"; -import { useTrack } from "hooks/analytics/useTrack"; import { ArrowLeftIcon, ArrowRightIcon } from "lucide-react"; import { useState } from "react"; import { useForm } from "react-hook-form"; @@ -166,7 +165,7 @@ function CreateProjectForm(props: { }) => void; }) { const [showAlert, setShowAlert] = useState<"no-domain" | "any-domain">(); - const trackEvent = useTrack(); + const createProject = useMutation({ mutationFn: props.createProject, }); @@ -214,30 +213,13 @@ function CreateProjectForm(props: { }), }; - trackEvent({ - category: "api-keys", - action: "create", - label: "attempt", - }); - createProject.mutate(formattedValues, { onSuccess: (data) => { props.onProjectCreated(data); toast.success("Project created successfully"); - trackEvent({ - category: "api-keys", - action: "create", - label: "success", - }); }, - onError: (err) => { + onError: () => { toast.error("Failed to create a project"); - trackEvent({ - category: "api-keys", - action: "create", - label: "error", - error: err, - }); }, }); } diff --git a/apps/dashboard/src/components/settings/AuthorizedWallets/AuthorizedWalletsTable.tsx b/apps/dashboard/src/components/settings/AuthorizedWallets/AuthorizedWalletsTable.tsx index 256b2efc6b9..dc091e861f5 100644 --- a/apps/dashboard/src/components/settings/AuthorizedWallets/AuthorizedWalletsTable.tsx +++ b/apps/dashboard/src/components/settings/AuthorizedWallets/AuthorizedWalletsTable.tsx @@ -8,7 +8,6 @@ import { import { createColumnHelper } from "@tanstack/react-table"; import { TWTable } from "components/shared/TWTable"; import { format } from "date-fns"; -import { useTrack } from "hooks/analytics/useTrack"; import { useState } from "react"; import { toast } from "sonner"; import { isAddress } from "thirdweb/utils"; @@ -27,7 +26,6 @@ const columnHelper = createColumnHelper(); export const AuthorizedWalletsTable: ComponentWithChildren< AuthorizedWalletsTableProps > = ({ authorizedWallets, isPending, isFetched }) => { - const trackEvent = useTrack(); const { mutateAsync: revokeAccess } = useRevokeAuthorizedWallet(); const [revokeAuthorizedWalletId, setRevokeAuthorizedWalletId] = useState< string | undefined @@ -96,29 +94,16 @@ export const AuthorizedWalletsTable: ComponentWithChildren< if (!revokeAuthorizedWalletId) { return; } - trackEvent({ - category: "account-settings", - action: "revoke-access-to-device", - label: "attempt", - }); + try { await revokeAccess({ authorizedWalletId: revokeAuthorizedWalletId, }); - trackEvent({ - category: "account-settings", - action: "revoke-access-to-device", - label: "success", - }); + toast.success("The selected device has been revoked."); } catch (error) { console.error(error); - trackEvent({ - category: "account-settings", - action: "revoke-access-to-device", - label: "error", - error, - }); + toast.error("Something went wrong while revoking the device", { description: "Please visit our support site: https://thirdweb.com/support", diff --git a/apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx b/apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx index 0254dffa271..fcd88c22060 100644 --- a/apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx +++ b/apps/dashboard/src/components/smart-wallets/SponsorshipPolicies/index.tsx @@ -20,7 +20,6 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { useMutation } from "@tanstack/react-query"; import type { ProjectBundlerService } from "@thirdweb-dev/service-utils"; import { GatedSwitch } from "components/settings/Account/Billing/GatedSwitch"; -import { useTrack } from "hooks/analytics/useTrack"; import { useTxNotifications } from "hooks/useTxNotifications"; import { TrashIcon } from "lucide-react"; import { useMemo } from "react"; @@ -34,7 +33,6 @@ import { z } from "zod"; type AccountAbstractionSettingsPageProps = { bundlerService: ProjectBundlerService; project: Project; - trackingCategory: string; teamId: string; teamSlug: string; validTeamPlan: Team["billingPlan"]; @@ -93,8 +91,6 @@ const aaSettingsFormSchema = z.object({ export function AccountAbstractionSettingsPage( props: AccountAbstractionSettingsPageProps, ) { - const { trackingCategory } = props; - const trackEvent = useTrack(); const updateProject = useMutation({ mutationFn: async (projectValues: Partial) => { await updateProjectClient( @@ -247,11 +243,6 @@ export function AccountAbstractionSettingsPage( : null, limits, }; - trackEvent({ - category: trackingCategory, - action: "update-sponsorship-rules", - label: "attempt", - }); const newServices = props.project.services.map((service) => { if (service.name === "bundler") { @@ -272,23 +263,8 @@ export function AccountAbstractionSettingsPage( services: newServices, }, { - onSuccess: () => { - trackEvent({ - category: trackingCategory, - action: "update-sponsorship-rules", - label: "success", - }); - onSuccess(); - }, - onError: (error) => { - onError(error); - trackEvent({ - category: trackingCategory, - action: "update-sponsorship-rules", - label: "error", - error, - }); - }, + onSuccess, + onError, }, ); })} diff --git a/apps/dashboard/src/hooks/analytics/useTrack.ts b/apps/dashboard/src/hooks/analytics/useTrack.ts deleted file mode 100644 index df27259eb54..00000000000 --- a/apps/dashboard/src/hooks/analytics/useTrack.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { useCallback } from "react"; - -export type TrackingParams = { - category: string; - action: string; - label?: string; - // biome-ignore lint/suspicious/noExplicitAny: FIXME - [key: string]: any; -}; -// TODO: remove this hook entirely -export function useTrack() { - return useCallback((trackingData: TrackingParams) => { - const { category, action, label, ...restData } = trackingData; - const catActLab = label - ? `${category}.${action}.${label}` - : `${category}.${action}`; - if (process.env.NODE_ENV !== "production") { - console.debug(`[PH.capture]:${catActLab}`, restData); - } - }, []); -} diff --git a/apps/nebula/src/@/components/blocks/buttons/MismatchButton.tsx b/apps/nebula/src/@/components/blocks/buttons/MismatchButton.tsx index 3dfa6911752..a3c56b1165d 100644 --- a/apps/nebula/src/@/components/blocks/buttons/MismatchButton.tsx +++ b/apps/nebula/src/@/components/blocks/buttons/MismatchButton.tsx @@ -122,7 +122,6 @@ export const MismatchButton = forwardRef< networksMismatch && wallet && !canSwitchNetworkWithoutConfirmation(wallet); const [isMismatchPopoverOpen, setIsMismatchPopoverOpen] = useState(false); - // const trackEvent = useTrack(); const chainId = activeWalletChain?.id; diff --git a/apps/nebula/src/@/components/ui/NavLink.tsx b/apps/nebula/src/@/components/ui/NavLink.tsx index 2319a19d4c4..b55b237590a 100644 --- a/apps/nebula/src/@/components/ui/NavLink.tsx +++ b/apps/nebula/src/@/components/ui/NavLink.tsx @@ -1,7 +1,6 @@ "use client"; import { cn } from "@/lib/utils"; -// import { useTrack } from "hooks/analytics/useTrack"; import Link from "next/link"; import { usePathname } from "next/navigation"; @@ -19,7 +18,6 @@ export type NavButtonProps = { }; export function NavLink(props: React.PropsWithChildren) { - // const track = useTrack(); const pathname = usePathname(); const isActive = pathname ? props.exactMatch @@ -34,14 +32,6 @@ export function NavLink(props: React.PropsWithChildren) { prefetch={false} onClick={() => { props.onClick?.(); - // if (props.tracking) { - // track({ - // category: props.tracking.category, - // action: props.tracking.action, - // label: props.tracking.label, - // url: props.href, - // }); - // } }} > {props.children} diff --git a/apps/nebula/src/@/utils/parse-error.tsx b/apps/nebula/src/@/utils/parse-error.tsx index 9b138f60e94..6929c136598 100644 --- a/apps/nebula/src/@/utils/parse-error.tsx +++ b/apps/nebula/src/@/utils/parse-error.tsx @@ -39,7 +39,6 @@ export function parseError(error: unknown): string | JSX.Element { // everything that falls through here should be logged and sent to posthog console.error("unknown error", error); - // posthog.capture("unknown_error", { error }); // worst case scenario send a generic error message back return UNKNOWN_ERROR_MESSAGE; } diff --git a/apps/nebula/src/app/(app)/components/Swap/common.tsx b/apps/nebula/src/app/(app)/components/Swap/common.tsx index 4493792c231..e9065f259e0 100644 --- a/apps/nebula/src/app/(app)/components/Swap/common.tsx +++ b/apps/nebula/src/app/(app)/components/Swap/common.tsx @@ -4,7 +4,7 @@ import { Button } from "@/components/ui/button"; import { getSDKTheme } from "@/config/sdk-component-theme"; import { useAllChainsData } from "@/hooks/chains"; import { cn } from "@/lib/utils"; -// import { useTrack } from "hooks/analytics/useTrack"; + import { CircleCheckIcon, CircleXIcon } from "lucide-react"; import { ExternalLinkIcon } from "lucide-react"; import { useTheme } from "next-themes"; @@ -128,8 +128,6 @@ export function useTxSetup() { }, }); - // const trackEvent = useTrack(); - const sendTx = useCallback( async ( tx: PreparedTransaction, @@ -137,24 +135,12 @@ export function useTxSetup() { ) => { let txHash: string | undefined; - // trackEvent({ - // category: "nebula", - // action: "execute_transaction", - // label: "attempt", - // }); - try { // submit transaction setStatus({ type: "sending" }); const submittedReceipt = await sendTransaction.mutateAsync(tx); txHash = submittedReceipt.transactionHash; - // trackEvent({ - // category: "nebula", - // action: "execute_transaction", - // label: "sent", - // }); - // wait for receipt setStatus({ type: "confirming", @@ -169,12 +155,6 @@ export function useTxSetup() { }); onTxSettled?.(txHash); - - // trackEvent({ - // category: "nebula", - // action: "execute_transaction", - // label: "confirmed", - // }); } catch (e) { console.error(e); if (txHash) {