Instrumentation · 12 min

When WebViews steal your events

The most expensive bug in a hybrid app is rarely a crash. It is a WebView that believes it owns purchase, session, and sometimes the install itself.

Close-up of a smartphone in use

We see the same pattern in almost every sandbox and in a surprising number of production apps. Native fires purchase when the store kit or a signed receipt arrives. The HTML checkout fires purchase on the thank-you page. A server pixel fires purchase when the webhook lands. Finance then chooses a number. Nobody wrote down who was allowed to speak.

Three thefts, not one

Duplication. The thank-you page reloads, or the user backgrounds the app and returns, and the pixel fires again. Your conversion rate looks healthy until reconciliation week.

Swallowing. The WebView takes over the visible surface so long that native screen_view stops. Analysts then invent a blended “engagement” metric that mixes HTML page views with native screens. Drop-off in onboarding becomes unreadable.

Hijack. The WebView writes a new session id, or worse, a new anonymous user, because the JS bridge passed a stale token. Attribution windows restart. Yesterday’s campaign gets credit for today’s checkout.

What the ownership table does

In Hybrid App Measurement Strategy we force an ownership table before anyone opens Firebase. Purchase is assigned to one runtime. The others become diagnostic streams with different event names. Diagnostic streams can still alert engineering. They do not enter the finance extract.

If your vendor wrapper will not let native observe the receipt, say so in the contract. Pretending native owns purchase when only HTML can see the success page is how ghost conversions survive code review.

A practical check this week

Open a production checkout, complete a test purchase, and export the three streams for that user id (or advertising id, if you still have one). Count purchase events in a thirty-minute window. If the count is not one, you do not have a measurement strategy yet — you have a negotiation.

The studio sandbox plants a duplicate on purpose. Finding it is day one. Writing the rule that prevents it is the rest of the course.

Back to the journal · Flagship syllabus