A/B TestingProNew in 5.15+
This bundle lets you split traffic between multiple Freeform forms (variants), track their performance, and identify a winner.
Overview
What It Does
- Assigns visitors to a variant based on configured variant weights.
- Persists assignment (cookie and/or logged-in user assignment).
- Tracks lifecycle events for each test session:
served(impression)interactedfailedcompleted(conversion)
- Provides CP dashboard data for charts and variant performance cards.
- For ended tests, serves the winning variant (best conversion rate).
A/B Test Stats & Metrics
You will see the following stats and metrics per test card in the A/B dashboard:
- Status (
Active/Ended/Scheduled), running days, variant count, total impressions. EditorDeletean existing test group.- Chart tabs:
- Conversion Rate -
completed ÷ served. - Impressions (
served): total sessions served.- Includes all final statuses (
served,interacted,failed,completed).
- Includes all final statuses (
- Interactions (
interacted): sessions that reached interacted/failed/completed states. - Failures (
failed): sessions ending in failed state.
- Conversion Rate -
- Variant cards show:
- Weight
- Impressions
- Interactions
- Failures
- Conversions (
completed)**: sessions ending in completed state. - Conversion rate
- Winner badge
Winner Selection
The winning variant is determined using the following criteria, in order:
- Highest conversion rate (
completed ÷ served). - If tied: the variant with the higher number of completed submissions.
- If still tied: the variant with the lower variant ID.
For completed tests, the selected winner is cached temporarily to improve performance during runtime lookups.
Usage
Creating a new A/B Test Group
Open A/B Tests from the Freeform navigation menu.
Click the Add Test button at the top right.
Configure the test group:
- Name
- Handle (auto-generated from name, editable)
- Description
- Start date
- Optional end date
- Variants (form + weight)
Keep in mind that the weights do not need to total 100%. Freeform will automatically calculate the ratios based on the values provided. For example, entering
50,30, and40will still distribute form impressions proportionally according to those weights.
Click the Save button.
Twig
Both snippets below ultimately render an A/B test form, but they differ mainly in how much control you have in Twig before rendering.
- Simple
- Customizeable
A simple, direct one-line render:
{{ freeform.abTest("myTestGroupHandle", {}).render }}
Retrieve the form first, allowing logic, checks, or customization before rendering:
{% set form = craft.freeform.abTest('myTestGroupHandle') %}
{% if form %}
<h2>{{ form.name }}</h2>
{{ form.render() }}
{% endif %}
- The argument is the A/B test handle.
- The variant provider resolves a variant for that handle.
- A/B metadata is injected into form render properties (
variant,sessionId) and used for tracking.