DocumentationA/B testing

A/B testing

Test two versions of a template in a campaign and pick the winner by open rate.

An A/B test splits a campaign's sends between two versions of the same template and measures which performs better. MailingCore attributes opens and clicks per variant and picks the winner when you close it.

Model

EntityWhat it is
AbTestThe test: template, status, trafficSplit and the winning variant
AbVariantEach version (versionId) with its sentCount, openCount, clickCount counters

Statuses: DRAFTRUNNINGCOMPLETED (or CANCELLED).

Endpoints

MethodPathDescription
GET/ab-testsList tests with the template name and each variant's subject
POST/ab-testsCreate a test (starts in DRAFT with two variants)
POST/ab-tests/:id/startDRAFTRUNNING
POST/ab-tests/:id/completeRUNNINGCOMPLETED, sets the winner

Guards: JwtAuthGuard + TenantGuard (dashboard authentication).

Create a test

POST /ab-tests
Authorization: Bearer <accessToken>
X-Tenant-Id: {tenantId}
Content-Type: application/json

{
  "name": "Onboarding subject",
  "templateId": "tmpl_123",
  "variantAId": "ver_a",
  "variantBId": "ver_b"
}
FieldRequiredNotes
nameYesTest name
templateIdYesTemplate under test (must belong to your tenant)
variantAId / variantBIdYesThe two versions to compare
trafficSplitNoStored; today both variants are created at weight 50/50

How it runs

  1. Start the test (/start) to move it to RUNNING.
  2. Send a campaign with that template. For each recipient, MailingCore picks a variant with a weighted split (cryptographic RNG) and increments its sentCount.
  3. Tracking attributes the first open and the first click of each email to the matching variant (openCount / clickCount).
  4. Complete the test (/complete): the winner is the variant with the highest open rate (openCount / sentCount); ties go to the first variant.