File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
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 @@ -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