Skip to content
All postsRevenue

Why we read payments from your provider instead of a purchase pixel

The classic way to get revenue into web analytics is a purchase event. You put a snippet on the thank-you page that says "a purchase of $49 just happened", the analytics tool records it, and revenue appears next to your traffic. It takes ten minutes and almost every analytics tool supports it.

We decided early that Reveata would not work that way. Payments come from your payment provider, and the browser only tells us who paid. This post explains why.

What goes wrong with a purchase pixel

A purchase event sent from the browser has to survive everything that can happen to a browser.

  • Blocked scripts. Some ad blockers and privacy settings block analytics scripts. A buyer who blocks the script never sends the purchase event, and the sale is missing from your analytics, though not from your bank account.
  • Closed tabs. People close the tab the moment they see "payment successful", sometimes before the page has finished loading. Redirects to the thank-you page fail. Some checkouts never send the buyer back at all.
  • Reloads and bookmarks. A thank-you page that is reloaded, opened from a bookmark or from the browser history can send the purchase again, and you count one sale twice.
  • Delayed payments. Bank transfers and other slow methods are "pending" when the buyer lands on the thank-you page. Some fail later. The pixel already counted them.
  • Refunds and disputes. The browser never hears about a refund three weeks later. Your analytics keeps the full sale forever.
  • Renewals. A subscription renews every month without the customer visiting your site. A pixel sees the first payment only, so the lifetime value of every channel is understated.
  • Anyone can send it. A purchase event is just a request from a browser. Anyone who opens the developer tools can send one with any amount.

The result is a revenue number that is sometimes too high and sometimes too low, and never matches what your payment provider says. We wrote about the many reasons the two numbers drift in Why your Stripe revenue never matches your analytics.

What we do instead

Reveata separates two questions.

How much was paid, and when? That comes from your payment provider: webhooks for new payments, refunds and subscription changes, plus a history import and periodic sync. You connect Stripe, Polar or Dodo Payments in Settings → Payments, or your own server can send payments through the Payments API. Each payment is stored once under the provider's own transaction id, however many times it arrives. See Why payments are never counted twice.

Who paid? That is where the browser helps. The tracking script adds the visitor id to the checkout: as client_reference_id on Stripe Payment Links, buy buttons and pricing tables, or through reveata.metadata() on a checkout your server creates. When the payment arrives from the provider, the id in its metadata links it to the visitor and their visits. If that is missing, Reveata tries the session id, then the user id or email of a visitor you identified, then the customer's earlier payments. The order is in How revenue attribution works.

The browser never creates a payment. It only points at one.

What this fixes

  • Blocked scripts lose attribution, not revenue. If a buyer blocked the script, the payment still arrives from the provider and counts in your revenue, as unattributed. Your totals match the provider.
  • Reloads add nothing. A thank-you page opened ten times records no extra payments.
  • Refunds subtract from the original payment's source, and lost disputes are treated like refunds.
  • Renewals keep their attribution. Each renewal inherits the first payment's source, so a channel keeps getting credit for the customers who stay.
  • Pending payments wait. A payment counts when the provider says it is paid.
  • Currency is handled. Amounts are converted to the website's currency at the exchange rate of the payment day.

The cost of doing it this way

It is more work to set up than a pixel, and we would rather say so.

  • You connect a provider in Settings → Payments, for Stripe with a restricted key or Connect with Stripe. Provider credentials are stored encrypted.
  • If your server creates checkouts, you pass the visitor id into the checkout's metadata. That is a few lines of code; the revenue attribution guide gives the exact lines for your stack.
  • Checkouts that cannot carry an id, such as a payment link in an email or a QR code, need another route. A thank-you page claim reads the checkout id from the thank-you page address and asks the provider whether it was paid, so a reload still adds nothing.

When the browser has to say more

Some platforms have no integration at all. For those, reveata('payment', { email }) on the thank-you page links the next payment with that email to the visitor. If you have no connected provider and want the amount too, you can turn on Accept unverified browser payments. It is off by default. Such payments are marked Unverified in the payments list, never produce subscription goals, and are replaced if a verified payment for the same sale arrives later. We made that option explicit and labelled because it has all the weaknesses of a pixel.

The short version

  • A purchase pixel counts what the browser saw, which is not what was paid.
  • Reveata takes amounts, refunds and renewals from the provider, and uses the browser only to say who paid.
  • Totals match your provider; only attribution depends on the browser.
  • Setup takes a little longer. The numbers are worth it.

To start, open Connect a payment provider.