Documentation
WooCommerce
Connect WooCommerce so paid orders count toward your A/B tests. When an order is paid, your store's server sends it to Splitlab, and Splitlab credits the revenue to the variant that shopper saw.
Because the report comes from your server rather than the shopper's browser, ad blockers and closed tabs don't lose revenue.
Before you start
- The Splitlab WordPress plugin installed and activated, with your project key saved.
- WooCommerce active. Classic checkout, block checkout and HPOS are all supported.
- Permission to create API keys in the Splitlab workspace.
1. Create an API key
- In Splitlab, select the workspace, then open Workspace settings → API keys. You can also get there from Integrations → WooCommerce → Create API key.
- Click Create key, give the key a name such as
WooCommerce – shop.example.com, and set Expires after to Never. - Copy the key. It starts with
sl_live_and is shown once.
Choose no expiry
When a key expires, your store stops reporting revenue. Each affected order gets a note saying the key was rejected, but nothing alerts you otherwise. If you set an expiry, replace the key before it ends.
2. Add the key to WordPress
- In WordPress, go to Settings → Splitlab.
- Paste the key into Server API key and click Save Changes.
That's all. There is no campaign to choose: Splitlab credits each order to the test the shopper was assigned to.
3. Check an order
Place a test order through your storefront, as a shopper would, and mark it Processing or Completed. Within a minute, the order shows a Splitlab note:
| Order note | Meaning |
|---|---|
| Splitlab: revenue attributed to a test variant. | The shopper was in a running test and the revenue was credited to their variant. |
| Splitlab: revenue recorded for the project. The shopper was not in a running test, so no variant was credited. | Reported successfully, but there was no test to credit. Expected when no test is running on the pages they visited. |
| Splitlab: this order was already reported. | Splitlab already had this order. Nothing was counted twice. |
| Splitlab: revenue not reported. The server API key was rejected; check Settings → Splitlab. | The key is wrong, revoked, expired, or belongs to another workspace. |
An order with no Splitlab note was not reported. See Troubleshooting.
How it works
- At checkout, the plugin copies the shopper's Splitlab visitor ID from the cookie
mvtVisitorId_<projectKey>_cookieonto the order. This has to happen at checkout: payment can finish later in a payment gateway callback, which has no access to the shopper's cookies. - When the order becomes Processing or Completed, the plugin queues a background job. Status is used rather than "payment complete" so bank transfer and cash on delivery orders count too.
- The job runs through WooCommerce's Action Scheduler, so checkout never waits on Splitlab. It sends the order to Splitlab's server-side revenue API and writes the order note.
Each order is reported once. The plugin records that it was sent, and Splitlab also ignores an order it has already counted.
What is sent
| Field | Value |
|---|---|
| Visitor ID | The Splitlab visitor ID captured at checkout |
| Amount | The order total, including tax and shipping |
| Currency | The order's currency |
| Order ID | The WooCommerce order key (wc_order_…), which is unique even across several stores sharing one Splitlab project |
| Page URL | The order-received page |
No customer name, email, address or line items are sent.
Cookie consent
If your Splitlab project requires cookie consent, the engine sets no visitor cookie until the shopper grants it. Orders from shoppers who did not consent have no visitor ID, so the plugin does not report them.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| No Splitlab note on any order | Server API key is empty | Add the key (step 2) |
| No Splitlab note on some orders | The shopper had no Splitlab cookie: no consent, cookies blocked, or the order was created in the admin rather than through the storefront | Expected. Only storefront orders from visitors Splitlab has seen can be credited |
| No note yet on a paid order | The background job has not run | Go to Tools → Scheduled Actions, search for splitlab_send_revenue, and check its status. WP-Cron must be running for queued jobs to execute |
| "API key was rejected" | The key is wrong, revoked, expired, or from another workspace | Create a new key in the same workspace as the project key and paste it in |
| Job shows Failed in Scheduled Actions | Splitlab could not be reached, or the request was rejected | Open the action's log for the error. A failed order is not marked as sent, so it can be reported again when its status changes |
| Revenue in Splitlab but on no variant | The shopper was not in a running test when they visited | Expected; see the order note meanings above |
Limitations
- Refunds are not reported. A refunded order still counts in Splitlab.
- Orders are reported in their own currency. The amount is not converted.
- Orders paid before the key was added are not sent retroactively.