Skip to content

fix(tracking): await plausible callback to confirm event sent#476

Merged
mohanadft merged 1 commit into
mainfrom
fix/plausible-await-callback
May 31, 2026
Merged

fix(tracking): await plausible callback to confirm event sent#476
mohanadft merged 1 commit into
mainfrom
fix/plausible-await-callback

Conversation

@mohanadft
Copy link
Copy Markdown
Collaborator

Summary

  • Changes window.plausible(...) call to use the callback option wrapped in a Promise, then await it
  • This ensures the HTTP request to Plausible actually completes before the handler returns, rather than fire-and-forget
  • Debug logging kept in place from previous PR

Why

The previous fire-and-forget call may have been cancelled if Qgiv tore down the embed or caused any page state change immediately after firing QGIV.donationComplete. Awaiting the callback guarantees the event is confirmed sent.

Test

  1. Go to https://techforpalestine.org/donate?variant=qgiv
  2. Open DevTools console
  3. Make a donation
  4. Confirm you see [T4P DEBUG] plausible await resolved — event confirmed sent
  5. Check Plausible dashboard for the event

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying website with  Cloudflare Pages  Cloudflare Pages

Latest commit: cc6aab9
Status: ✅  Deploy successful!
Preview URL: https://64ccb640.website-aun.pages.dev
Branch Preview URL: https://fix-plausible-await-callback.website-aun.pages.dev

View logs

@mohanadft mohanadft merged commit 1d3e0b9 into main May 31, 2026
5 checks passed
@mohanadft mohanadft deleted the fix/plausible-await-callback branch May 31, 2026 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant