Skip to content

[-]:feat/ Send purchase conversion after payment - #2209

Merged
jaaaaavier merged 2 commits into
masterfrom
fix/impact-conversion-on-payment
Oct 13, 2026
Merged

jaaaaavier merged 2 commits into
masterfrom
fix/impact-conversion-on-payment

Conversation

@jaaaaavier

@jaaaaavier jaaaaavier commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

Background: In the current situation, conversions are tracked once the user has completed registration; this is causing us to lose conversions. Therefore, in this PR, let’s propose tracking conversions once payment has been completed. To do this:

  • analytics.service.ts

    • New getPurchaseBuyer(): returns who made the purchase. Logged-in user return an uuid and email.
      Buyer without account return Stripe customer (cus_…) and checkout email.
    • New sendPurchaseEvents() Sends Meta and, if there is a buyer, GA and Impact.
    • trackCheckoutCompleted() always clears the payment data at the end, because nothing waits for it anymore.
    • Removed trackDeferredPurchase()
  • analytics/types.ts: PurchaseBuyer type.

  • impact.service.ts

    • savePaymentDataInLocalStorage() stores the Stripe customerId instead of the deferred purchase flag.
    • trackPaymentConversion(buyer) receives the buyer instead of reading the user.
  • ga.service.ts: trackPurchase(buyer) receives the buyer instead of reading the user.

  • useUserPayment.ts: passes the Stripe customerId when saving the payment data.

  • auth.service.ts: back to its state before Account setup only sends the signup event.

  • types.ts and storage-keys.ts: checkout_customer_id replaces is_passwordless_purchase and is cleared with the rest of the payment data.

  • Updated unit tests, and added cases for buyers without an account, without a Stripe customer, and logged in.

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

  • Sent a test conversion with a cus_… customer to the Impact service. Impact accepted it and queued it.

Additional Notes

@jaaaaavier jaaaaavier self-assigned this Oct 13, 2026
@jaaaaavier jaaaaavier added the enhancement New feature or request label Oct 13, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: d8c67ec
Status: ✅  Deploy successful!
Preview URL: https://07b65152.drive-web.pages.dev
Branch Preview URL: https://fix-impact-conversion-on-pay.drive-web.pages.dev

View logs

@sonarqubecloud

Copy link
Copy Markdown

@jaaaaavier
jaaaaavier marked this pull request as ready for review October 13, 2026 15:29
@jaaaaavier
jaaaaavier requested review from a team, CandelR, larryrider and xabg2 as code owners October 13, 2026 15:29
@jaaaaavier
jaaaaavier merged commit 4f3702a into master Oct 13, 2026
11 checks passed
@jaaaaavier
jaaaaavier deleted the fix/impact-conversion-on-payment branch October 13, 2026 15:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants