
Server-side revenue API
Report purchases from any store or backend and have Splitlab credit them to the variant the buyer saw, with no ad blocker losses.
Send a purchase to Splitlab from your server after payment succeeds, and Splitlab credits the revenue to the variant the buyer saw. Use it for any store or backend that Splitlab has no ready-made integration for. The WooCommerce integration is built on this API. Server-side reporting survives ad blockers and closed tabs, but your server has no visitor context of its own, so you pass the buyer's Splitlab visitor ID with each purchase.
What Splitlab tracks
Purchases with an amount, currency and your own order ID
Each order ID once: reporting the same order again does not count twice
Optional extra data, such as the page where the purchase completed or a specific revenue metric
How it works
The Splitlab snippet assigns each visitor to a variant and stores their visitor ID in the first-party cookie
mvtVisitorId_<projectKey>_cookie. Your checkout reads it and stores it with the order.After payment succeeds, your server sends
POST https://api.splitlab.io/api/v1/track/revenuewith the visitor ID, project key, amount, currency and order ID, authenticated with anx-api-keyheader.Splitlab credits the purchase to the variant that visitor saw and returns whether it was attributed, so your report compares revenue per visitor across variants.
Set it up
In Splitlab, open Workspace settings → API keys and create a key. Choose Never for expiry on keys used by integrations. Keep the key on your server.
At checkout, read the visitor ID from the cookie
mvtVisitorId_<projectKey>_cookieand store it with the order. Capture it at checkout, not at payment: payment webhooks have no cookies.After payment, send a request with
visitorId,projectId(your project key),campaignId(send""to let Splitlab find the test),revenueAmountin normal units such as49.99,currencyas an ISO 4217 code, and a uniqueorderId.Check the response.
attributed: truemeans the revenue was credited to the visitor's variant;deduplicated: truemeans that order was already reported.
Good to know
The key must belong to the same workspace as the project you report into. A key from another workspace gets
403, and a missing, revoked or expired key gets401.Retrying a request that already succeeded is safe, because each
orderIdcounts once.Refunds cannot be reported through this API yet. A refunded order still counts in Splitlab.
If your project requires cookie consent, the visitor cookie only exists once the visitor has consented.
Never put the API key in browser code.
Start testing with Splitlab, or book a demo and we will walk you through the setup.