Skip to content

Commit 3a9aa1a

Browse files
committed
Dashboard: Fix Payment link buy completion tracking (#7783)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on simplifying the `reportPaymentLinkBuySuccessful` and `reportPaymentLinkBuyFailed` functions by removing unnecessary parameters and adjusting their calls accordingly. ### Detailed summary - Removed `linkId` and `clientId` parameters from the `reportPaymentLinkBuySuccessful` function. - Adjusted the call to `reportPaymentLinkBuySuccessful` in `PayPageWidget.client.tsx` to no longer pass parameters. - Simplified the call to `reportPaymentLinkBuyFailed` by removing `linkId` and `clientId` parameters and retaining only `errorMessage`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Streamlined payment reporting by simplifying success and failure event tracking. Payment success is now always reported without additional details, and payment failure reports only include the error message. No impact on payment or redirect flows. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 572368e commit 3a9aa1a

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

apps/dashboard/src/@/analytics/report.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,8 @@ export function reportPaymentLinkCreated(properties: {
435435
* ### Who is responsible for this event?
436436
* @greg
437437
*/
438-
export function reportPaymentLinkBuySuccessful(properties: {
439-
linkId: string;
440-
clientId: string;
441-
}) {
442-
posthog.capture("payment link buy successful", properties);
438+
export function reportPaymentLinkBuySuccessful() {
439+
posthog.capture("payment link buy successful");
443440
}
444441

445442
/**
@@ -451,8 +448,6 @@ export function reportPaymentLinkBuySuccessful(properties: {
451448
* @greg
452449
*/
453450
export function reportPaymentLinkBuyFailed(properties: {
454-
linkId: string;
455-
clientId: string;
456451
errorMessage: string;
457452
}) {
458453
posthog.capture("payment link buy failed", properties);

apps/dashboard/src/app/pay/components/client/PayPageWidget.client.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -62,24 +62,16 @@ export function PayPageWidget({
6262
image={image}
6363
name={name}
6464
onSuccess={() => {
65+
reportPaymentLinkBuySuccessful();
66+
6567
if (!redirectUri) return;
6668
const url = new URL(redirectUri);
67-
if (paymentLinkId && clientId) {
68-
reportPaymentLinkBuySuccessful({
69-
linkId: paymentLinkId,
70-
clientId: clientId,
71-
});
72-
}
7369
return window.open(url.toString());
7470
}}
7571
onError={(error) => {
76-
if (paymentLinkId && clientId) {
77-
reportPaymentLinkBuyFailed({
78-
linkId: paymentLinkId,
79-
clientId: clientId,
80-
errorMessage: error.message,
81-
});
82-
}
72+
reportPaymentLinkBuyFailed({
73+
errorMessage: error.message,
74+
});
8375
}}
8476
paymentLinkId={paymentLinkId}
8577
purchaseData={purchaseData}

0 commit comments

Comments
 (0)