Revenue attribution
AB Test credits each order to the variant its visitor saw — including orders that finish checkout on a separate host or through a third-party checkout that never fires the storefront pixel.
The problem: some checkouts bypass the pixel
The Web Pixel that AB Test installs runs on your storefront. It records purchase events well when checkout stays on the storefront, but a growing share of orders complete somewhere the pixel cannot see:
- Shop Pay — the buyer is handed off to a separate checkout host, so the storefront pixel never sees the completed order.
- India third-party checkouts — one-page and express checkouts such as Razorpay Magic, GoKwik, Shopflo, and Shiprocket/Fastrr take over the checkout step and replace the native flow.
If attribution relied on the pixel alone, these sales would go uncounted — and they are often a large fraction of revenue. Under-counting conversions on one variant quietly biases your results, so AB Test uses a second, checkout-independent path to book revenue.
The solution: a cart attribute that rides to the order
AB Test attaches an anonymous visitor id to the cart itself, so the assignment travels with the order no matter where checkout finishes. The chain looks like this:
- When a visitor is assigned to a variant, the storefront app embed stamps their anonymous visitor id (
_ab_vid) as a Shopify cart attribute. - Because it lives on the cart, that value is carried into the order as an entry in
note_attributes— regardless of which checkout host or third-party provider completes the sale. - Shopify fires an
orders/createwebhook to AB Test. The app readsnote_attributes._ab_vid, looks up which variant that visitor was assigned to, and books the order's revenue to that variant.
The cart attribute travels with the cart, not with the browser session. That is what lets AB Test attribute a purchase even when the final checkout step happens on a different host or inside a third-party checkout.
What AB Test reads from an order
The orders/create webhook payload contains a lot of customer information. AB Test deliberately reads only the few fields it needs to attribute and total revenue:
| Field | Why it is read |
|---|---|
| Order id | To record the sale once and dedupe against pixel events. |
| Total | To sum revenue per variant. |
| Currency | To report revenue in the store's currency. |
note_attributes._ab_vid | To map the order back to the assigned variant. |
AB Test never reads customer name, email, phone, or address. No personally identifiable information (Protected Customer Data Level 1) is stored, and the visitor id is pseudonymous.
Requirements for attribution to work
For an order to be credited to a variant, two things must be true:
- The app embed is enabled. Turn on the "AB Test" app embed under Online Store > Themes > Customize > App embeds so it can stamp
_ab_vidas a cart attribute. Keep the Web Pixel enabled as well. - The cart attribute reaches the order. Most checkouts, including Shop Pay and the supported India third-party checkouts, preserve cart attributes into
note_attributes. A custom checkout that strips cart attributes cannot carry_ab_vidthrough, and such an order will not be attributed.
After launching a test, place a real test order and check the order's note_attributes in the Shopify admin for an _ab_vid entry. If it is present, revenue attribution is wired up correctly for that checkout path.
Deduplication with the pixel
When checkout stays on the storefront, the same purchase can be seen twice: once by the Web Pixel and once by the orders/create webhook. AB Test deduplicates on the order id, so each order is counted at most once toward a variant's revenue and conversions. The webhook path is what fills the gap for checkouts the pixel cannot observe; the two paths together avoid both under- and double-counting.
Where attributed revenue appears
Booked revenue flows into your test's results: per-variant revenue and conversion rate, Bayesian probability-to-be-best, and the segment breakdowns (device, new vs returning, country, UTM, referrer, cookie). See Results for how to read those numbers and apply a winner.
Privacy
Revenue attribution is built to stay within Protected Customer Data Level 1: only order id, total, currency, and AB Test's own note_attributes._ab_vid are read — never customer name, email, phone, or address. Visitors are pseudonymous, opt-out consent is honored through the Shopify Customer Privacy API (which auto-detects OneTrust and Cookiebot), and attribution data is retained about 180 days before it is purged. For the full picture, see Privacy.