Splitlab home

Book a Demo

Splitlab home

Book a Demo

Splitlab home

Search for articles…

Report revenue from your own server

Report revenue from your own server

If your checkout is custom, your server can report each purchase to Splitlab once payment succeeds. Server-side reporting isn’t affected by ad blockers or closed tabs, and Splitlab credits the revenue to the variant the buyer saw.

1. Create an API key

  1. In Splitlab, open Workspace settings → API keys and click Create key.

  2. Set Expires after to Never for a key your checkout depends on, or plan to replace it before it expires.

  3. Copy the key. It starts with sl_live_ and is shown only once.

The key must belong to the same workspace as the project you report into. Keep it on your server and never put it in browser code.

2. Capture the visitor ID at checkout

Your server has no visitor context of its own, so you need the buyer’s Splitlab visitor ID. The engine stores it in a first-party cookie on your site:

mvtVisitorId_<projectKey>_cookie

Read it when the buyer checks out and store it with the order. Payment often completes later in a webhook that has no cookies, so capture it at checkout, not at payment. If your site requires cookie consent, the cookie only exists once the visitor has consented.

3. Send the purchase

After payment succeeds, send a POST request with your key in the x-api-key header:

POST https://api.splitlab.io/api/v1/track/revenue
Content-Type: application/json
x-api-key: sl_live_…

{
"visitorId": "<value of the visitor cookie>",
"projectId": "<your project key>",
"campaignId": "",
"revenueAmount": 49.99,
"currency": "USD",
"orderId": "order_10421"
}

  • Leave campaignId as an empty string to let Splitlab find the test the visitor was assigned to.

  • Send revenueAmount in normal currency units (49.99, not cents).

  • Use a unique orderId. Reporting the same order again never counts it twice.

  • Optionally send pageUrl, the page where the purchase completed. It helps when a visitor is in several tests.

4. Read the response

  • attributed: true: credited to the visitor’s variant.

  • attributed: false: recorded for the project, but the visitor wasn’t in a running test.

  • deduplicated: true: this order was already reported.

  • 401: the key is missing, unknown, revoked or expired. 403: the key belongs to a different workspace.

It’s safe to retry on network errors and 5xx responses. Fix the request before retrying a 400, 401 or 403.

5. Know the limits

Refunds can’t be reported through this API yet, so a refunded order still counts. The full field list is in the Server-side revenue API reference.

6. Still stuck?

Getting attributed: false on every order? Get in touch through our contact page or email team@splitlab.io and tell us which page or integration you’re working on.

Still stuck?

Email team@splitlab.io or send us a message.

Contact us


Start optimizing for revenue today not just conversion rates.

Run experiments, track revenue per variation, and scale what actually makes you money.

We’ll increase your conversion rate by 30% or you don’t pay. Terms apply.


Start optimizing for revenue today not just conversion rates.

Run experiments, track revenue per variation, and scale what actually makes you money.

We’ll increase your conversion rate by 30% or you don’t pay. Terms apply.


Start optimizing for revenue today not just conversion rates.

Run experiments, track revenue per variation, and scale what actually makes you money.

We’ll increase your conversion rate by 30% or you don’t pay. Terms apply.