From 77a8a546a00446ac0c67b7647a1753652943e82b Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Thu, 31 Jul 2025 12:00:59 -0700 Subject: [PATCH 1/2] chore: update payments empty state link to the payment links page --- .../payments/components/RecentPaymentsSection.client.tsx | 7 ++++++- .../[team_slug]/[project_slug]/(sidebar)/payments/page.tsx | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/RecentPaymentsSection.client.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/RecentPaymentsSection.client.tsx index 8b5234d31c2..eb2ac17bb6f 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/RecentPaymentsSection.client.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/components/RecentPaymentsSection.client.tsx @@ -19,6 +19,8 @@ import { TableRow } from "./PaymentsTableRow"; export function RecentPaymentsSection(props: { client: ThirdwebClient; projectClientId: string; + teamSlug: string; + projectSlug: string; teamId: string; }) { const { data: payPurchaseData, isLoading } = useQuery< @@ -95,7 +97,10 @@ export function RecentPaymentsSection(props: { className="flex items-center gap-2" asChild > - + Create Payment Link diff --git a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx index cce84c1ef57..21d07ff9ab9 100644 --- a/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx +++ b/apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/payments/page.tsx @@ -45,6 +45,8 @@ export default async function Page(props: { client={client} projectClientId={project.publishableKey} teamId={project.teamId} + projectSlug={params.project_slug} + teamSlug={params.team_slug} />
Date: Thu, 31 Jul 2025 12:09:06 -0700 Subject: [PATCH 2/2] chore: adds payment link tracking --- apps/dashboard/src/@/analytics/report.ts | 28 +++++++++++++++++++ apps/dashboard/src/app/pay/[id]/page.tsx | 6 ++++ .../client/PayPageWidget.client.tsx | 7 +++++ 3 files changed, 41 insertions(+) diff --git a/apps/dashboard/src/@/analytics/report.ts b/apps/dashboard/src/@/analytics/report.ts index c898ff45932..dcc55ad4fb1 100644 --- a/apps/dashboard/src/@/analytics/report.ts +++ b/apps/dashboard/src/@/analytics/report.ts @@ -428,3 +428,31 @@ export function reportUpsellClicked(properties: UpsellParams) { export function reportPaymentCardClick(properties: { id: string }) { posthog.capture("payment card clicked", properties); } + +/** + * ### Why do we need to report this event? + * - To track payment link usage + * + * ### Who is responsible for this event? + * @greg + */ +export function reportPaymentLinkVisited(properties: { + linkId: string; + clientId: string; +}) { + posthog.capture("payment link visited", properties); +} + +/** + * ### Why do we need to report this event? + * - To track payment link usage + * + * ### Who is responsible for this event? + * @greg + */ +export function reportPaymentLinkCompleted(properties: { + linkId: string; + clientId: string; +}) { + posthog.capture("payment link completed", properties); +} diff --git a/apps/dashboard/src/app/pay/[id]/page.tsx b/apps/dashboard/src/app/pay/[id]/page.tsx index 6bf7fb4b6ee..af271aba88b 100644 --- a/apps/dashboard/src/app/pay/[id]/page.tsx +++ b/apps/dashboard/src/app/pay/[id]/page.tsx @@ -2,6 +2,7 @@ import type { Metadata } from "next"; import { defineChain, getContract } from "thirdweb"; import { getCurrencyMetadata } from "thirdweb/extensions/erc20"; import { checksumAddress } from "thirdweb/utils"; +import { reportPaymentLinkVisited } from "@/analytics/report"; import { getPaymentLink } from "@/api/universal-bridge/links"; import { getClientThirdwebClient } from "@/constants/thirdweb-client.client"; import { PayPageWidget } from "../components/client/PayPageWidget.client"; @@ -32,6 +33,11 @@ export default async function PayPage({ paymentId: id, }); + reportPaymentLinkVisited({ + linkId: id, + clientId: paymentLink.clientId, + }); + const tokenContract = getContract({ address: paymentLink.destinationToken.address, // for this RPC call, use the dashboard client // eslint-disable-next-line no-restricted-syntax diff --git a/apps/dashboard/src/app/pay/components/client/PayPageWidget.client.tsx b/apps/dashboard/src/app/pay/components/client/PayPageWidget.client.tsx index 1fffd4e9bbe..959b9a82958 100644 --- a/apps/dashboard/src/app/pay/components/client/PayPageWidget.client.tsx +++ b/apps/dashboard/src/app/pay/components/client/PayPageWidget.client.tsx @@ -5,6 +5,7 @@ import { useEffect } from "react"; import { createThirdwebClient, NATIVE_TOKEN_ADDRESS, toTokens } from "thirdweb"; import { AutoConnect, CheckoutWidget } from "thirdweb/react"; import { checksumAddress } from "thirdweb/utils"; +import { reportPaymentLinkCompleted } from "@/analytics/report"; import { useV5DashboardChain } from "@/hooks/chains/v5-adapter"; export function PayPageWidget({ @@ -60,6 +61,12 @@ export function PayPageWidget({ onSuccess={() => { if (!redirectUri) return; const url = new URL(redirectUri); + if (paymentLinkId && clientId) { + reportPaymentLinkCompleted({ + linkId: paymentLinkId, + clientId: clientId, + }); + } return window.open(url.toString()); }} paymentLinkId={paymentLinkId}