Skip to content
whovisited.

Conversion goals · Payments

Track confirmed checkout payments without counting button clicks

Separate checkout intent from a confirmed payment, use Stripe webhooks for fulfillment, and send a privacy-conscious browser event for session-level analytics.

A checkout click is not a paid order

A visitor presses “Buy,” opens a hosted checkout page, and returns to your site. Those steps show intent and a browser redirect; by themselves, they do not prove that money was collected. The visitor could close checkout, have a payment declined, lose their connection, or leave before the confirmation page finishes loading. Counting the button click as a purchase overstates completed payments.

Use two signals for two different jobs. Your payment provider and application database establish whether an order is paid and fulfilled. A browser analytics event can show that a website session reached the point your application considers confirmed. Keep the business ledger authoritative and use analytics to understand which visits are associated with that outcome.

Let your server confirm the payment

For Stripe Checkout, process payment events on your server. Verify each webhook signature, handle the relevant event types for your payment methods, and make order fulfillment safe to run more than once for the same Checkout Session. Stripe documents `checkout.session.completed` for completed Checkout Sessions and `checkout.session.async_payment_succeeded` for delayed methods that succeed later. A completed Checkout flow is not always the same as funds being available immediately.

Record the provider event or Checkout Session against your internal order using an idempotent update. Only let your order state become `paid` after your payment rules say it qualifies. Do not trust a `success=true` query parameter, a client-side return URL, or a visitor editing browser state as proof of payment.

A webhook is also important because a customer may pay successfully but never return to your site. Stripe explicitly warns that fulfillment triggered only from the landing page can miss those customers. The redirect improves the on-site experience; the server event is what lets your system process the payment even when the browser disappears.

Send a browser event only after the app confirms the order

If you want to compare payment-confirmation sessions with acquisition sources in WhoVisited, have the success page ask your own server for the current order state. When that response confirms the order is paid, the page can call the existing browser tracker with one stable event name, such as `purchase_confirmed`. Do not fire it when the visitor clicks the checkout button or merely lands on a return URL.

js
// In the success-page module; call after loading order status from your server.
let sentOnThisPage = false;
function onOrderStatusLoaded(orderStatus) {
  if (sentOnThisPage || orderStatus !== "paid") return;
  sentOnThisPage = true;
  window.whovisited?.track("purchase_confirmed");
}

The example illustrates the timing and event name; connect `orderStatus` to your authenticated order-status endpoint and ensure the code runs once per success-page visit. WhoVisited's tracker sends browser events. It does not accept a Stripe webhook directly or turn a browser event into verified accounting data. A customer can pay without loading the page, and consent choices, blockers, network failures, or browser exit can prevent the analytics event from arriving.

Keep the event payload minimal. A fixed name is enough for a name-matched goal; do not send the customer's email, card details, Checkout Session ID, order ID, or line-item contents just to count a completed session. WhoVisited's current Growth goal matches an exact custom event name, not event properties.

Configure and test a session-level goal

  1. In the website's Settings, add a Custom event goal named “Confirmed purchase session” and use the exact event name `purchase_confirmed`. Keep that name stable in the application code.
  2. Use a Stripe test-mode payment and verify that your webhook handler updates the test order only once. Test an unsuccessful payment too; it must not produce the paid state.
  3. On the return page, confirm your app reads the saved order state from its server before sending the analytics event. Reload the page and observe what your UI does so you know whether it can send a duplicate raw event.
  4. Open browser DevTools Network and check the WhoVisited events request and response. Then use the goal's Test goal control or the Growth report to confirm the matching event is retained under the expected website and session.
  5. Repeat with a delayed payment method if your checkout offers one. Verify the application waits for the successful asynchronous payment outcome before presenting the order as paid.

The Growth report counts a session once when at least one retained event in that same session matches the selected goal. That makes it useful for comparing sources or landing pages, but it is not a count of orders: two purchases in one session still produce one goal session, and a repeated event does not make the report a payment ledger.

Expect a difference between payment totals and analytics

Your server may record more paid orders than WhoVisited records goal sessions because some buyers never load the return page or do not allow analytics. The reverse can happen too: a session can emit the browser event more than once, while the Growth report still counts one goal session. Use the order database or Stripe reports for money, refunds, subscription renewals, and order-level reconciliation. Use WhoVisited to investigate the sessions, sources, and landing pages associated with a deliberately defined browser signal.

If the report shows no matching goal, check the exact event name, website, session, consent state, and event request before changing payment logic. A script loading successfully does not prove that a custom event was accepted. Conversely, a matching goal does not prove funds settled or fulfillment completed.

Limits and references

WhoVisited's public browser tracker can send named custom events, and the Growth report groups matching events into converted sessions. It does not provide server-side event ingestion or financial reconciliation. Stripe's webhook and fulfillment flow should remain responsible for payment confirmation and order processing; the browser event is optional context for analytics.

For payment handling, use Stripe's Checkout fulfillment and webhook documentation. For the analytics side, see WhoVisited's guide to choosing a success-page or custom-event goal and its contact-form example that avoids collecting form contents.

References and further reading

  1. Stripe: Fulfill orders with Checkout
  2. Stripe: Receive events in a webhook endpoint
  3. WhoVisited: Success-page goals or custom events
  4. WhoVisited: Track contact form conversions without collecting form contents