File tree Expand file tree Collapse file tree 5 files changed +49
-1
lines changed Expand file tree Collapse file tree 5 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -428,3 +428,31 @@ export function reportUpsellClicked(properties: UpsellParams) {
428428export function reportPaymentCardClick ( properties : { id : string } ) {
429429 posthog . capture ( "payment card clicked" , properties ) ;
430430}
431+
432+ /**
433+ * ### Why do we need to report this event?
434+ * - To track payment link usage
435+ *
436+ * ### Who is responsible for this event?
437+ * @greg
438+ */
439+ export function reportPaymentLinkVisited ( properties : {
440+ linkId : string ;
441+ clientId : string ;
442+ } ) {
443+ posthog . capture ( "payment link visited" , properties ) ;
444+ }
445+
446+ /**
447+ * ### Why do we need to report this event?
448+ * - To track payment link usage
449+ *
450+ * ### Who is responsible for this event?
451+ * @greg
452+ */
453+ export function reportPaymentLinkCompleted ( properties : {
454+ linkId : string ;
455+ clientId : string ;
456+ } ) {
457+ posthog . capture ( "payment link completed" , properties ) ;
458+ }
Original file line number Diff line number Diff line change @@ -19,6 +19,8 @@ import { TableRow } from "./PaymentsTableRow";
1919export function RecentPaymentsSection ( props : {
2020 client : ThirdwebClient ;
2121 projectClientId : string ;
22+ teamSlug : string ;
23+ projectSlug : string ;
2224 teamId : string ;
2325} ) {
2426 const { data : payPurchaseData , isLoading } = useQuery <
@@ -95,7 +97,10 @@ export function RecentPaymentsSection(props: {
9597 className = "flex items-center gap-2"
9698 asChild
9799 >
98- < Link href = "/pay" target = "_blank" >
100+ < Link
101+ href = { `/team/${ props . teamSlug } /${ props . projectSlug } /payments/links` }
102+ target = "_blank"
103+ >
99104 Create Payment Link
100105 < ArrowRightIcon className = "size-4" />
101106 </ Link >
Original file line number Diff line number Diff line change @@ -45,6 +45,8 @@ export default async function Page(props: {
4545 client = { client }
4646 projectClientId = { project . publishableKey }
4747 teamId = { project . teamId }
48+ projectSlug = { params . project_slug }
49+ teamSlug = { params . team_slug }
4850 />
4951 < div className = "h-12" />
5052 < QuickStartSection
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import type { Metadata } from "next";
22import { defineChain , getContract } from "thirdweb" ;
33import { getCurrencyMetadata } from "thirdweb/extensions/erc20" ;
44import { checksumAddress } from "thirdweb/utils" ;
5+ import { reportPaymentLinkVisited } from "@/analytics/report" ;
56import { getPaymentLink } from "@/api/universal-bridge/links" ;
67import { getClientThirdwebClient } from "@/constants/thirdweb-client.client" ;
78import { PayPageWidget } from "../components/client/PayPageWidget.client" ;
@@ -32,6 +33,11 @@ export default async function PayPage({
3233 paymentId : id ,
3334 } ) ;
3435
36+ reportPaymentLinkVisited ( {
37+ linkId : id ,
38+ clientId : paymentLink . clientId ,
39+ } ) ;
40+
3541 const tokenContract = getContract ( {
3642 address : paymentLink . destinationToken . address , // for this RPC call, use the dashboard client
3743 // eslint-disable-next-line no-restricted-syntax
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { useEffect } from "react";
55import { createThirdwebClient , NATIVE_TOKEN_ADDRESS , toTokens } from "thirdweb" ;
66import { AutoConnect , CheckoutWidget } from "thirdweb/react" ;
77import { checksumAddress } from "thirdweb/utils" ;
8+ import { reportPaymentLinkCompleted } from "@/analytics/report" ;
89import { useV5DashboardChain } from "@/hooks/chains/v5-adapter" ;
910
1011export function PayPageWidget ( {
@@ -60,6 +61,12 @@ export function PayPageWidget({
6061 onSuccess = { ( ) => {
6162 if ( ! redirectUri ) return ;
6263 const url = new URL ( redirectUri ) ;
64+ if ( paymentLinkId && clientId ) {
65+ reportPaymentLinkCompleted ( {
66+ linkId : paymentLinkId ,
67+ clientId : clientId ,
68+ } ) ;
69+ }
6370 return window . open ( url . toString ( ) ) ;
6471 } }
6572 paymentLinkId = { paymentLinkId }
You can’t perform that action at this time.
0 commit comments