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/(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} />
{ if (!redirectUri) return; const url = new URL(redirectUri); + if (paymentLinkId && clientId) { + reportPaymentLinkCompleted({ + linkId: paymentLinkId, + clientId: clientId, + }); + } return window.open(url.toString()); }} paymentLinkId={paymentLinkId}