Every A/B test has at least a Control and a Treatment. Control is the current experience. Treatments are the changes you want to measure. Free is limited to those two arms. Pro can add more variants (A/B/n) and set each arm’s traffic weight.
Assignment happens on the HTML request (wp, priority 0), before the page is painted:
wp_head for the assigned variant.wp_footer.That server-side timing is why targeted URLs cannot be fully page-cached while a test is running — the first HTML response has to include the correct variant. See Page Cache and Running Tests.
PHP is for changes that must exist in the first HTML: filters, template tweaks, or enqueueing assets. The snippet is admin-owned code, same trust model as a Code Snippets plugin. Do not include opening <?php tags. Runtime errors are caught and written to the experiments log; they do not fatally break the storefront.
For anything more than a few lines, put the logic in your theme or a small plugin and gate it:
if ( function_exists( 'wpdai_in_experiment' ) && wpdai_in_experiment( 'pricing-headline', 'treatment' ) ) {
// Treatment-only markup or filters.
}
Helpers work on the storefront after assignment. They return false / null for holdout visitors and for anyone not in that experiment. Full reference: Developer Helpers.