chameleon-system/ab-test-bundle

Allows sending different versions of the website to the user depending on the ab testing setting

8.0.2 2026-03-27 14:56 UTC

README

The bundle allows the site administrator to swap pages against other pages and static spots against other static spots simply by passing a variable to the page.

The tests will be reported to google optimize (see server-side experiments - see https://developers.google.com/optimize/devguides/experiments).

Since the tests run server side, we need to manage user segregation on the server side.

Configuration

There is a new option in the main menu to create A/B tests. When you select it, you will see a list of experiments and the option to create/delete experiments.

For each experiment you can create variants, each with a definable probability of being selected. For each variant you can define a set of pages that should be replaced by other pages, and a set of templates for which you want to change static modules.

  • Experiments must be assigned to a portal
  • Only one experiment can be active at any one time
  • Each variant is assigned a probability of being selected. The sum of the probabilities must be no greater than 100.
  • Please make sure to always create a variant for the "default" (i.e. unchanged) version of the page.

Testing

For testing purposes, you can pass the parameter chameleon-system-ab-test with the identifier of the variant you want to test in order to manually select a variant.

Important:

  • This will only work, if a variant has not already been selected. So if you have already opened the website, you will need to reset your session cookie before adding the parameter to your URL.
  • You will need to be signed into the backend in the same session for the selector to work. So make sure you log into the backed after clearing your session cookie and before calling the frontend.

Tracking

The bundle currently only supports integration via the google tag manager (https://support.google.com/optimize/answer/6314801). You can also install the tracking using the global site tag (gtag - https://support.google.com/optimize/answer/7513085 ) or the older analytics.js (https://support.google.com/optimize/answer/6262084). In that case however, you will need to modify the google analytics integration provided by chameleon.

Extending

You can add your own logic on how a variant is selected by implementing \ChameleonSystem\AbTestBundle\Interfaces\ExperimentVariantSelectorInterface and tagging the service with chameleon_system_ab_test.selector. By setting the priority attribute in the tag, you can position your selection relative to existing selectors (lower numbers will be executed first). If your selector returns null, then the next selector in line will determine which variant is selected.

The bundle comes with two selectors:

  • a selector that allows you to choose the variant via query parameter with priority 10
  • a selector that uses the probability set in the variant to select a variant from the first experiment passed with a priority of 1000

Relevant Tables

esono_ab_test esono_ab_test_variant

name
identifier
weight_percentage

esono_ab_test_variant_page_mapping

source_cms_tpl_page_id
target_cms_tpl_page_id

esono_ab_test_variant_static_module_mapping

cms_master_pagedef
cms_master_pagedef_spot

cms_master_pagedef_spot

esono_ab_test_variant_static_module_mapping_id