Set up and launch a server-side A/B experiment

portrait de l'auteur Julie Trenque

Written by Julie Trenque

Updated on 05/05/2022

5 min


Was this content useful?

What is server-side A/B testing?

Kameleoon has extensive support for mobile and server-side implementations of experiments, feature flags and personalizations. We provide SDKs in the main web (PHP, Java, NodeJS..) and mobile apps languages (Android and iOS). More information on Kameleoon SDKs

Working server-side means you create variants of your pages by using a server-side SDK (rather than a client-side technology based on a JavaScript technology). Whereas our client-side technology retrospectively changes HTML pages once these have been generated by the server via standard DOM-handling APIs, our server SDKs let you make these changes directly at the point where the HTML pages are generated (server-side testing).

More information on the Kameleoon server-side and its benefits

Why and when choose server-side rather than client-side?

  • In the case of client-side A/B testing, the A/B experiment is rendered on the client-side through JavaScript. This solution is easily accessible to marketers with average technical knowledge: edition with a graphic interface for simple modifications on look and feel.
  • In the case of server-side A/B testing, the A/B experiment is rendered directly on the web server. It allows making more complex experiments, with less impact on page load time and no flickering. Server-side testing is intended for IT, product and development teams: necessity to code the variation back-end and to push a code release. It therefore requires more flexibility and organisation in the process of creating experiments.

How to create and launch a server-side A/B experiment?

On the Experiment dashboard, click on “New Experiment”

Select “In the Code editor”.

We offer two types of experiment:

  • JS/CSS to create an experiment using your custom JS/CSS code;
  • SDK to create a server-side, mobile app or client-side experiment with one of our SDKs;
  • hybrid to create an experiment that runs both server-side and client-side (mainly for the result tracking). Please note that this type of experiment is only compatible with our web SDKs.

Select the “SDK” type of experiment.

Enter the mandatory fields and click on “Create”.

The Code editor launches in a new tab.


The header displays the main information associated with the experiment:

  • its name (you can double-click to edit it) ;
  • its status (draft, scheduled, online, paused, deviated or stopped);
  • the last interaction (last save or update, publication date…).

You can check that the changes you have made have been saved. Two types of backup are available:

  • automatic when the experiment is in draft, scheduled or paused;
  • manual for online and deviated experiments (via the green button in the “Finalize” tab).

“Experiment” block

By default, the Variations block is displayed. To access the Experiment block, simply click on “Experiment”.

Experiment-specific code

For all variations, you can add, modify or delete JSON data. To retrieve the JSON associated to a variant, you need to use the “obtainVariationAssociatedData” function of our SDKs.

  • Code options

If you click on the 3-point menu associated with the “Experiment specific code” menu, a sub-menu opens and allows you to access options.

Choose here to include or exclude the original of the changes you have just made. If the box is checked, the JSON data will also be injected on the original variation.

Tags and description

Edit the description of your experiment or the associated tags if you wish.

URL of the tested page

You can edit the URL of the tested page here. By default, the URL is the one you entered in the pop-up window for creating your server-side A/B experiment.

Experiment results page

If your experiment has already been launched, a link will take you to the results page.

If your experiment is stopped, a green button at the bottom of the editor offers you direct access to the results page.

“Variations” block

By default, the Variations block is displayed when you access the Code editor.

It allows you to inject JSON data on the variations of your server-side A/B experiment.

On the left side, you can add, duplicate, rename or remove a variation.

In the right part, you can add, modify or delete JSON data. This will apply to the selected variation.

At the bottom right of the code window is an expand option.

Click on this button to expand the code area or use the following keyboard shortcut (while editing your code):

  • On Windows: CTRL + B
  • On MAC OS: Control + SHIFT + B

Add a variation

Click on “+ Add a variation”.

The color circle associated with the variation fills up when the variation is selected. This allows you to navigate between the different variations of your server-side experiment.

Variation menu

By clicking on the 3 points to the right of each variation, a menu opens.

You can rename, duplicate or delete the variation. The changes made via this menu will then apply only to the selected variation.

“Finalize” block

Finalization steps

On the left side, you have to validate at least two steps to be able to launch your experiment:

  • traffic distribution ;
  • goal(s) ;
  • targeting (optional).

On click, each step will display the details of the chosen configuration.

  • Traffic distribution

Click the pencil icon to set up the traffic distribution on your A/B experiment.

A visitor assigned to a variation (original or variation) will keep it as long as the experiment runs.

A visitor assigned to the excluded traffic can be re-bucketed to an existing variation (original or variation) as soon as you increase the % of trafic by taking it from the Excluded sample

Confirm your choice: the step is validated, a green check indicates it in the editor.

  • Goal(s)

Select at least one goal that you want to associate with your server-side A/B experiment.

Confirm your choice: the step is validated, a green check indicates it in the editor.

  • Targeting

For server-side A/B experiments, you can add a targeting segment based on the custom data you have created in your Kameleoon site. This step is optional. To send us the custom data values you would like to use to target visitors, you need to use the function “addData” of our SDKs.

For server-side experiments that use our Nginx or Apache web servers modules: you can add a targeting based on page URL(s). It is a mandatory step for these experiments as our web servers modules (Nginx or Apache) work by doing an internal redirect (page A or B). To know more, please read this technical documentation

A segment created for a server-side experiment will automatically be flagged with a “server-side” tag. More information on this segment type

Select from the drop-down list the segment you wish to associate with your experiment, or click on “Create a new segment” to open the pop-in window for creating a server-side segment.

If you have already created a server-side segment

You will find it in the drop-down list and you can associate it directly to the experiment.

If you want to associate a client-side segment

if it contains only the targeting conditions specific to server-side segments (“custom data” and “page URL”) and is not already used in an active experiment, then you can find it in the drop-down list. However, an action is required to associate it. The pop-in asks you to choose between duplicating it (its copy will automatically be of type “server-side”) or transforming it into a “server-side” segment (this action is irreversible);

if it contains only the targeting conditions specific to the server-side segments (“custom data” and “page URL”) but is already used in an active experiment, you will find it in the drop-down list and the only action proposed is duplication (its copy will automatically be of type “server-side”). By hovering over the list icon at the bottom left, you can display all the active experiments on which this client-side segment is used.

If you want to create a server-side segment

Click on “Create a new segment” and follow the instructions specific to this type of segment.

Validate: the server-side segment is associated with your experiment! Targeting will be done according to these criteria. A green check indicates validation in the Code editor.

Experiment status

On the “Finalize” section, at the top right, an insert reminds you of the status of your experiment: draft, scheduled, online, paused, deviated or stopped.

Once your experiment is launched, you can change its status by clicking on the arrow to scroll through the possible actions.


The insert is unfolded by default. You will find the website to which your server-side A/B experiment is associated, as well as the creation date of your experiment.


The insert is unfolded by default. At a glance, you will find the ID of your experiment as well as the IDs of each of the variations of your A/B server-side experiment.

Activation buttons


Click on the “Publish” button to immediately launch your server-side A/B experiment.

A summary pop-in shows the main configuration of your experiment, as well as the steps to follow. All you have to do is code your server-side variations, using the appropriate server-side IDs. You can follow these instructions.

You can copy everything at once by clicking on “Copy all” at the bottom left.

Click on “Publish”: a message will confirm that the experiment has been successfully launched and the status of the experiment will change from “Draft” to “Online”.

You stay on the Code editor and can make changes to your experiment if necessary.

Save and update

During the creation of your experiment, you can save your changes and exit the Code editor. Your experiment will be saved as a draft and you will be redirected to the A/B Dashboard.

Once your experiment is online, you can still make changes to it. The saving of your changes is indicated at the top left of the Code editor, just below the experiment name.

Two types of saving are available :

  • automatic when the experiment is in draft, scheduled or paused;
  • manual for online and deviated experiments.

How do I find a server-side A/B experiment?

“Type” Column

A column is dedicated to the experiment type. If your experiment is server-side, it will be mentioned on this column.


On your A/B dashboard, you can apply one or more filters to find an experiment. The “Server-side or apps” filter is selectable in the “Type” filter category. Only the server-side experiments will be displayed.

Secondary actions

By clicking on the 3 dots icon located on the very right of the experiment card, a panel appears in which you can access the Code editor .

As with all A/B experiment cards, it is also possible to duplicate the experiment and its configuration, delete it (if it is in draft or stopped), manage its status and view the results.

How to access and analyze the results of your server-side A/B experiment?

In a 100% server-side A/B experiment, the analysis can only be done in Kameleoon. It excludes third party analytics solutions. If you want to send the results to Google Analytics for example, you need to create a hybrid experiment and follow this process.

As with all other types of experiments, the results page of a server-side A/B experiment is accessible from the experiment card on the A/B Dashboard.

You cannot change the status of the experiment from this page and the targeting tab is not available in the right side menu.

  • In this article :