Splitlab

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

  1. In Splitlab, select the workspace, then open Workspace settings → API keys. You can also get there from Integrations → WooCommerce → Create API key.
  2. Click Create key, give the key a name such as WooCommerce – shop.example.com, and set Expires after to Never.
  3. 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

  1. In WordPress, go to Settings → Splitlab.
  2. 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 noteMeaning
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

  1. At checkout, the plugin copies the shopper's Splitlab visitor ID from the cookie mvtVisitorId_<projectKey>_cookie onto 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.
  2. 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.
  3. 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

FieldValue
Visitor IDThe Splitlab visitor ID captured at checkout
AmountThe order total, including tax and shipping
CurrencyThe order's currency
Order IDThe WooCommerce order key (wc_order_…), which is unique even across several stores sharing one Splitlab project
Page URLThe order-received page

No customer name, email, address or line items are sent.

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

SymptomCauseFix
No Splitlab note on any orderServer API key is emptyAdd the key (step 2)
No Splitlab note on some ordersThe shopper had no Splitlab cookie: no consent, cookies blocked, or the order was created in the admin rather than through the storefrontExpected. Only storefront orders from visitors Splitlab has seen can be credited
No note yet on a paid orderThe background job has not runGo 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 workspaceCreate a new key in the same workspace as the project key and paste it in
Job shows Failed in Scheduled ActionsSplitlab could not be reached, or the request was rejectedOpen 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 variantThe shopper was not in a running test when they visitedExpected; 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.