Setup
Step 1: Admin Interface Setup¶
Enabling A/B Testing in Admin Interface¶
The first step to enable A/B Testing is to enable it in your Admin Interface. We added the option to enable it via the Implementation tab (in the left menu in the Admin Interface). After opening the Implementation tab, click on A/B Testing and you will be presented with the following page.
On this page, click on the toggle to enable A/B Testing and a popup will appear. Please read the information shown there carefully and then click Enable A/B Testing to enable the functionality.

Defining the Variants¶
After enabling the A/B Testing tools you will be shown a page with the Configuration tab. On it, you can add your different Variants into JSON. Variants are the different versions of the Consent Management Platform that you want to test against each other on your page.
To understand this better, we provide the following example with two different variants, Variant0 and Variant1:
{
"variant0": {},
"variant1": {
"firstLayer": {
"variant": "BANNER"
}
}
}
variant0 shows empty JSON, meaning that it is not modified and represents the Consent Management Platform that you configured inside the Admin Interface. In this case, we assume you have enabled the Privacy Wall in the Admin Interface.
variant1 shows JSON with a rule for the First Layer Layout, determining that in Variant1 the First Layer Layout will be a BANNER instead of a WALL.
Preview¶
You can use the preview in the Admin Interface, to compare and test the Variants you defined. To use the preview, please click on the preview button in the bottom left corner of the Admin Interface.
Once you decided if the Draft or Live version should be displayed, a drop down menu in the preview allows you to switch between the different variants.

Step 2: Performing the A/B Test¶
After you have set up the A/B test in your admin interface, we offer two ways to deploy the different variants.
You can use our internal feature or you can use all common third party A/B Testing tools.

Usercentrics Internal A/B Testing¶
You can enable the internal A/B Testing by selecting the "Activate with Usercentrics" option in the Admin Interface under Implementation / A/B Testing. When using Usercentrics to display your variants, they are always evenly distributed (e.g. 50:50 in case of two variants).
Note
Make sure the toggle "Enable results for AbVariant" is enabled to display the data from your A/B test at the top right corner under Interaction Analytics Overview.
To get insights into the performance of the different variants, different options are provided within the Analytics section in the Admin Interface:
Option 1: Interaction Analytics Overview
Filter the analytics data for one of the variants under Interaction Analytics Overview. To do this, select the respective variant in the "variant" dropdown at the top right corner.

Option 2: Interaction Analytics Comparison
Directly compare the interaction and accept rates for the variants under Interaction Analytics Comparison / Variant Analytics.

Option 3: Interaction Analytics Reporting
Download and use the Interaction Analytics Reporting to get in-depth insights. An additional "variant" column will tell you which variant was used for each entry in the data.
A/B Testing with Third-Party Tool¶
To get even more detailed insights into your A/B test, we also offer the possibility to perform it with third-party A/B Testing tools. Before diving into the different setups, we would like to give some general technical insights and recommendations.
window.UC_AB_VARIANT
Your A/B Testing tool must set window.UC_AB_VARIANT to the name of the variant it has assigned (e.g. window.UC_AB_VARIANT = "variant1"). The Consent Management Platform reads this value to decide which variant configuration to apply — it does not set the variable itself.
Script Order & Timing
We recommend that you add your A/B Testing tool script in the <head> section of your code before the Usercentrics Consent Management Platform, since the A/B Testing tool needs to assign the variant before the Consent Management Platform reads it.
In practice, the Consent Management Platform checks window.UC_AB_VARIANT every 25ms for up to 2 seconds after it starts loading. If your A/B Testing tool sets the variable within that window — regardless of exact script order — the Consent Management Platform will pick it up. If it isn't set within 2 seconds, a warning is logged to the console and the Consent Management Platform proceeds with its default configuration (no variant applied).
Forcing a variant with data-ab-variant / abVariant
Instead of relying on an external tool, you can force a specific variant directly:
- Script tag (V3): add
data-ab-variant="variant1"to the Usercentrics script tag. - SDK: pass
abVariant: "variant1"in the SDK's init options.
This is useful for QA, direct links to a specific variant, or server-side/URL-based assignment. If the value doesn't match one of the variants you defined in the Admin Interface, it's ignored.
Avoiding timing issues with ui.suppress
If your A/B Testing tool can't reliably set window.UC_AB_VARIANT within the 2-second window (e.g. it loads asynchronously or after user interaction), you can prevent the Consent Management Platform from rendering its UI automatically and trigger it manually once the variant is known:
window.ucCmpConfig = {
ui: { suppress: true }
}
With ui.suppress set, the Consent Management Platform initializes normally but does not display its UI until you call window.__ucCmp.showFirstLayer() (or another display method) — giving your A/B Testing tool as much time as it needs to set window.UC_AB_VARIANT first.
UC_UI_CMP_EVENT
We defined various UI events that can be used in your A/B Testing tool to track the interactions of your users with the different variants. For example, these events include ACCEPT_ALL (user clicks on accept all) or SAVE (user clicks on the save button).
Currently, we provide a setup guide for Optimizely and Kameleoon. Soon we will add guides for various other tools, like Google Optimize, Optimizely, and trbo.