Configure an A/B test
The test builder is used to create your A/B test.
| All fields except for the description are required for the A/B test to be in a runnable state. |
Basic information
The basic setup panel records a name and description for the A/B test.
- Test name
-
This is required. Enter a suitable name for your A/B test. This name will be presented on the test management screen, and also in the select list that displays available tests when you connect an A/B test to your page builder block.
- Description
-
This is optional. Enter a short description that outlines your test.
Test page
| A/B testing can only be configured on URLs that are Content page assets stored within the DXP CMS. Other pages (such as Standard Pages) cannot currently be connected to an A/B test. |
- Website domain
-
Enter the domain of your website where the A/B testing will run. (for example,
www.example.com)This domain must match the domain of the site where the test is running, but you do not need to include the protocol or any path component. - Content page asset
-
Displays the connection status of this A/B test. In order to use this A/B test you need to connect it from the content page asset in your DXP CMS website. It will display Not connected if this test is not currently connected to a content page.
The A/B test cannot be started until it is fully configured and connected.
Variants
- Content variants
-
You can define names for your A and B variants, which will be displayed in your A/B testing report. The content of the A and B variants would be completed using the page builder within your connected content page.
Display options
The Display options section defines who should see the test and its variants, and how variant traffic is split within that audience.
What segment targeting means
Segment targeting separates two decisions:
-
Audience — which visitors may participate in the experiment.
-
Traffic distribution — among participants, what share sees variant A versus variant B.
Visitors outside the audience are never randomly assigned. They see Variant A on the page, as they would when the test does not apply to them.
Results in the console and PDF follow the audience mode: one site-wide comparison for All visitors, or per-segment comparisons when you target segments (see Segment-targeted results).
Target audience
Choose who is eligible to participate in the test:
- All visitors
-
The test can be shown to any visitor who loads the connected content page (default).
- Only segments of visitors
-
The test is limited to visitors who belong to at least one segment you select from your organization’s Customer Data Platform (CDP). Visitors who do not match any selected segment are not included in the test and continue to see Variant A on the page.
| The Only segments of visitors option requires segment access for your organization. If you do not have access, the option is disabled and a message explains that you can contact customer success to add it to your subscription or contact your organization owner for access. |
Segmentation
When Only segments of visitors is selected, the Segmentation controls appear below Target audience.
Select which segments of visitors should see the test.
| You can attach a maximum of five segments to one A/B test. Add segment is unavailable once five segments are selected. |
A visitor who belongs to any one of the selected segments is in the test audience. They do not need to match every segment on the list.
You must select at least one segment before you can save or create the test when Only segments of visitors is selected.
-
Click Add segment.
-
In the dialog, either follow Create segment in Customer data platform to open CDP segmentation, or choose an available segment from the list and confirm.
After you create a new segment in CDP, refresh the A/B test configuration page before the new segment appears in the list.
Each selected segment is shown as a card with its name, segment type (Single segment), and consent mode (Consent required or Consentless). Use the remove control on a card to detach a segment; you are asked to confirm before it is removed.
You can read more about segmentation in the CDP documentation.
When variant assignment runs
Variant assignment—the random choice of variant A or variant B—runs only when all of the following are true:
-
The A/B test is running (not draft, scheduled but not yet started, paused, or finished). See Variant presentation for when Variant A is shown instead.
-
The visitor loads the connected content page for this test.
-
The visitor is in the test audience:
-
All visitors — any visitor who loads the page is eligible.
-
Only segments of visitors — the visitor must belong to at least one of the selected segments (up to five on the test) when the page is served.
-
If any condition is not met, the visitor is not entered into the experiment, the random split is not run, and they see Variant A.
For an eligible visitor, assignment happens on the first page view in that browser session while the test is running. The split uses the percentages under Traffic distribution below; the same variant is kept for the rest of the session.
Traffic distribution
Within the chosen audience, this option controls how eligible visitors are distributed between the two variants of the A/B test. The default is an even distribution (50% to each variant), but you can vary this to match your needs.
Choose how much you would like each content variant served to users in this test by moving the slider or by entering the percentage values directly into the fields at either end. Each variant can be set between 1% and 99%.
The percentages assigned to each variant set the probability for a user being assigned to group A or to group B.
The group is assigned when a user first accesses the page containing the variants while they are in the test audience.
Probability calculation
To determine which group a new user is assigned:
-
A random number between 1 and 100 is generated and assigned to the user.
-
If the generated number is below the configured distribution threshold (
50for 50% distribution,10for 10% distribution) the user will be placed in Group A. -
Inversely, if the generated number is above the threshold, they will be assigned to Group B.
-
Once assigned to a group the user will always see the same variant for the duration of their session.
-
This same process is applied to every new user that makes a request.
When multiple content blocks on a page are configured to be part of the A/B test, the variants are treated as sets with all Variant A blocks forming one set and all Variant B blocks forming another set.
-
If a visitor is distributed to Variant A, the page they see will render with Variant A active for each content block to which the test has been connected.
-
If a visitor is distributed to Variant B, the page they see will render with Variant B active for each content block to which the test has been connected.
Success metric
This setting allows you to choose between a page view and a click event to associate with a successful A/B test result.
|
Page view
Success is achieved if the user navigates to the URL specified in the linked Page URL field after seeing one of the test variants.
-
The Page URL must exactly match the destination URL visited by the user (including the protocol and any default page extension) for the test to be marked as successful.
The best way to determine this URL is to do the following:
-
Visit your public site.
-
Locate the page you wish to track.
-
Copy the URL from your browser address bar.
-
Paste the URL into Page URL field.
-
-
The Page URL must be served by the Squiz DXP via the CloudFlare layer. URLs can only be tracked if they are served by the Squiz DXP.
-
Javascript tracking code is not required for the page views metric.
Click event
Success is achieved if the user clicks on a particular element.
The particular element is identified using a JavaScript element selector.
This requires JavaScript code be added to the page.
The JavaScript tracks the click event for the targeted element.
When you choose to use a click event, a banner will be displayed at the top of the A/B test configuration screen, reminding you that you need to install the Javascript for the test to function.
If you click the copy code button on the banner it will copy the Javascript code to your clipboard.
|
Javascript handler for the custom event
A Javascript handler must be added to your page to handle and register the click event.
How this is added will vary depending on the page on which you are tracking click events.
The purpose of this script is to listen for the click event, and submit this as a custom event when a click is detected.
| Remember to remove your Javascript code once the A/B test has concluded. It will not have any lingering effects, but may produce errors logged to your console. |
<script defer>
(function () {
const element = document.querySelector('#element_id'); (1)
const url = new URL('/__dxp/events/custom', window.location.origin);
if (!element) {
console.warn('The element was not found. The click event cannot be handled');
return;
}
element.addEventListener('click', async () => {
await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
credentials: 'include',
body: '{"action":"abtest.click","event":{"abTestId":"example-ab-test-id"},"source":"custom"}', (2)
redirect: 'follow',
});
});
})();
</script>
| 1 | Update the #element_id to match the selector of element that you are testing. |
| 2 | Update the example-ab-test-id to the abTestId for the A/B test you are linking.
If you copy the code using the copy code button on the page banner, this value will be filled in automatically for you. Your AB testing ID can be obtained by managing/editing your A/B test and copying the AB testing ID from the URL. The ID is a GUID; a string of letters and numbers joined with dashes. The URL format is https://dxp.squiz.cloud/organization/<YOUR-ORGANIZATION>/optimization/experiments/<AB-TEST-ID>. |
Schedule
The schedule for an A/B test determines when and how the test will be started and stopped.
The schedule is configured from the Schedule section on the A/B testing configuration screen.
Test start
This section defines how and when your A/B test will start. You can schedule a specific date for the A/B test to automatically start, or choose to start the test manually.
- Start date
-
Set the date and time that the A/B test will start from the calendar picker.
The start date is selected from the month view and the month and year can be selected using the appropriate drop-down menus.
The start time can be set using the drop-down menus that appear below the calendar.
The timezone is determined by your web browser and will normally be your local time. - Start manually
-
When this option is selected the A/B test will only start when you choose the Start test option from the A/B testing management screen.
Test duration
This defines when your A/B test will finish.
You have a choice to set a specific end date, base the test on a fixed number of visitors, or just let the test run indefinitely until you manually end the test.
- End date
-
Set the date and time that the A/B test will finish from the calendar picker.
The finish date is selected from the month view and the month and year can be selected using the appropriate drop-down menus.
The finish time can be set using the drop-down menus that appear below the calendar.
The timezone is determined by your web browser and will normally be your local time. - Visitors amount
-
The A/B test ends when a set number of visitors have been served the test.
- Finish manually
-
The A/B test runs until you manually finish the test.
You can manually finishs an A/B test by managing a running test and clicking the … button and selecting the Finish option.
Calculate duration
Expanding the calculate duration panel opens a tool to help advise you on an appropriate end date or total visitor count to use in your A/B test.
The calculation is based on some basic site metrics, and you will need to provide your current conversion rate, desired conversion rate and daily visitor numbers.