Hosted Checkout Breaks Purchase Analytics; Webhooks Restore Attribution
A developer building subscriptions for Belle AI found that a standard GA4 purchase event on the thank-you page recorded almost no sales. Hosted checkout sends users to the payment provider's domain, so they often never return to the site, and revenue appeared in the payment dashboard but not in analytics. To fix this, the developer stored first-touch UTM parameters and referrer data in localStorage, which are preserved across later visits. At checkout, that attribution data and GA4 identifiers were passed into the order metadata, which the payment provider returns in its webhook. The webhook handler then sends a purchase event to GA4 via the Measurement Protocol, reusing the stored client and session IDs so sales are credited to the correct traffic source.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in