Skip to main content
With an A/B test, the shop serves the same page in several variants and measures which of them leads to the goal more often. A test is created in the A/B test manager; in the template, the tags with the prefix ABTest- determine what a visitor actually gets to see. Three tags are sufficient for this. ABTest-active() switches on the test area in the first place, ABTest-caseA to ABTest-caseJ enclose the individual variants, and ABTest-TriggerConversion() reports the success back on the target page. All three tags are permitted in all templates. Guide: A/B test

The structure in the template

The two area tags always belong nested inside each other. On the outside is ABTest-active() with the test ID, on the inside one area for each test case created in the A/B test manager.
The negative area is part of it. Without it, nothing at all appears at this point as soon as the test has ended or its ID no longer exists. What should be visible outside the test phase must therefore be explicitly included in the template.
Upper and lower case of the tag names and the test ID do not matter. ABTest-active and abtest-Active lead to the same result. Nevertheless, stick to one spelling, otherwise a later search in the template directory will not find all occurrences.

ABTest-active()

The area is displayed if the A/B test with the specified ID is currently active. The test ID is passed as a parameter and must match the ID from the A/B test manager exactly.

How the test case is assigned

The shop does not assign the test case randomly. When the test is first called in a session, it determines which test case has had the fewest views so far and assigns that one. This distributes visitors evenly across the variants, without one variant ending up with significantly less data than the other. Counting is done per subshop. A test running in several subshops therefore balances its distribution in each subshop separately.
The view is only counted by the positive area {ABTest-active(…)}, not by the negative one. A template that works exclusively with {!ABTest-active(…)} therefore delivers no data to the test.

ABTest-caseA to ABTest-caseJ

The area is displayed if the corresponding test case is assigned to this visitor. For each test case created in the A/B test manager, a separate area belongs in the template, from ABTest-caseA up to a maximum of ABTest-caseJ. More than ten test cases are not possible.
These tags are only valid within the enclosure of ABTest-active(). If they are placed outside it, the tag is invalid and is not evaluated as an enclosure.
The letter in the tag corresponds to the order of the test cases in the A/B test manager: the first test case is A, the second B, and so on. It is independent of how you named the test case there. If a test case is deleted in the manager, the test cases behind it move up by one letter. In this case, check the assignment in the template, otherwise variant B will suddenly show the content of C.

ABTest-TriggerConversion()

Counts a conversion for the test with the specified ID. The tag belongs on the page whose call is counted as a success.
The tag is only needed if “By tag on target page” has been set as the conversion goal in the A/B test manager. For the other goals, the shop counts itself, and the tag then has no effect.
The test ID must match the ID from the A/B test manager exactly. A typo goes unnoticed in the page source code but distorts the evaluation.
For verification, the tag writes an HTML comment into the page when a test ID is found:
It is visible in the source code of the target page but not in the browser. This lets you check whether the tag is in the right place without waiting for the evaluation in the A/B test manager.

Viewing variants specifically

In test mode, you can call up each test case yourself instead of waiting for the shop to assign it. To do this, the shop is called with three parameters:
With ab-test-id=off you end the A/B test mode again without leaving the general test mode.
Calls in test mode are not included in the evaluation. Neither views nor conversions are counted, so you can switch between the variants as often as you like.
Test mode only takes effect if A/B tests are enabled for the shop and the specified test ID actually exists. If the ID is incorrect or the letter is not a valid test case, test mode silently remains unset and you see the regularly assigned variant. In that case, check the spelling of the ID first.
Unlike in live operation, test mode only checks whether the test has been created, not whether it is currently running. You can therefore view variants before the start and after the end of a test.
  • Guide: A/B test
  • Guide: Enabling and disabling shop test modes