Abuja Digital Studio · Est. 2018
Start a Project
DocsOConvertA/B testing
Reference

A/B testing

OConvertorravo.com/docs/oconvert/ab-testing

A/B testing

OConvert's A/B engine has two surfaces: shortcode-based content swaps and DOM-patch variants edited live with the visual capture mode.

Shortcode swaps

The [oconvert_test] and [oconvert_variant] shortcodes wrap content blocks. OConvert_Tests::sc_test() picks the variant for the current visitor and renders only that variant's children.

[oconvert_test key="pricing-page"]
  [oconvert_variant id="a"]<original block>[/oconvert_variant]
  [oconvert_variant id="b"]<new block>[/oconvert_variant]
[/oconvert_test]

If the test has no key attribute, every variant renders raw (useful while drafting).

Sticky assignment

OConvert_Tests::resolve_variant_for_visitor():

  1. Reads the ocv_vid cookie.
  2. Looks up wp_oconvert_assignments for an existing (vid, test_key) pair. If found, returns that variant.
  3. Otherwise picks variants[ crc32(vid + ':' + key) % count(variants) ] and inserts a new assignment row.

The table has a unique key on (vid, test_key), so a given visitor is locked into their variant for the duration of their cookie.

Visual editor (capture mode)

Admins can patch a variant's DOM without writing CSS. Append ?ocv_capture=1&test_key=<key>&variant=<id> to any front-end URL while logged in as an manage_options user. OConvert loads oconvert-capture.js, which overlays a click-to-patch UI. Clicking an element and confirming a replacement POSTs to:

POST /wp-json/oconvert/v1/test/<key>/variant/<id>/patches

The patch is stored in the variant's patches[] array (in the variants JSON column of wp_oconvert_tests). The front-end runtime applies patches at render time: selector, mode (replace, text, attr), html, text, attr, value.

Conversion reporting

Each exposure fires a expose event; each goal fires a convert event with { test_key, variant, goal }. OConvert_Events::test_summary($test_key) returns per-variant exposure count, conversion count, and rate.

A/B testing · OConvert Docs | Orravo