Enterprise license required
Features described on this page require the Kentico Xperience Enterprise license.
A/B testing allows marketers to create different versions of pages and evaluate them according to the subsequent behavior of the website's visitors. You can confirm which changes are actually beneficial and use the content that works best for the users who visit your website. The testing process does not interfere with browsing on the website. Visitors do not need to give any feedback manually.
See A/B testing pages for more information.
The A/B testing functionality uses cookies (opens in a new tab) to keep track of the page variant displayed to individual visitors. For A/B testing to work correctly for all visitors, your site's Default cookie level setting must be set to Visitor or All. Otherwise the testing only works for visitors who give consent and increase their cookie level.
For visitors who do not accept Visitor or All cookies, the behavior depends on your site's default cookie level. If the default level is Essential, the system at least tracks A/B testing page variants to keep content consistent, but does not log any conversions. If the default level is System, no A/B testing cookies are allowed and each view of a tested page displays a randomly selected variant.
To learn more about cookies and consents in Xperience, see:
To configure your website so that it allows A/B testing:
Permission requirements
To work with A/B tests in the Pages and A/B tests applications, users need to have permissions for:
Additionally, developers need to make the following adjustments on the side of the live site application:
Open your MVC project in Visual Studio.
Enable the A/B testing feature by calling the UseABTesting method of the ApplicationBuilder instance.
Enable the feature at the start of your application's life cycle, for example in the Application_Start method of your project's Global.asax file.
MVC projects created by the installer contain the ApplicationConfig class, whose RegisterFeatures method is called in the Application_Start method by default. You can use this class to encapsulate all of your ApplicationBuilder code (enabling and configuring of Xperience MVC features).
Note: The feature must be enabled before you register routes into the application's RouteTable. The Kentico().MapRoutes() method adds required routes based on the set of enabled features.
using Kentico.OnlineMarketing.Web.Mvc;
using Kentico.Web.Mvc;
...
protected void Application_Start()
{
...
// Gets the ApplicationBuilder instance
// Allows you to enable and configure selected Xperience MVC integration features
ApplicationBuilder builder = ApplicationBuilder.Current;
// Enables the A/B testing feature, which provides system routes used to log A/B testing data and conversions
builder.UseABTesting();
...
}Register A/B testing logging scripts onto all pages by calling the ABTestLoggerScript extension method in views.
@using Kentico.OnlineMarketing.Web.Mvc
@using Kentico.Web.Mvc@* Registers scripts that ensure logging of analytics data for A/B tests *@
@Html.Kentico().ABTestLoggerScript()Open your live site project in Visual Studio.
Edit your application's startup class (Startup.cs by default).
Enable the A/B testing feature by calling the UseABTesting method of the IFeaturesBuilder delegate passed to the IServiceCollection.AddKentico method within ConfigureServices.
using Kentico.OnlineMarketing.Web.Mvc;
using Kentico.Web.Mvc;
...
public void ConfigureServices(IServiceCollection services)
{
...
// Enables and configures Xperience features
services.AddKentico(features =>
{
// Enables the A/B testing feature, which provides system routes used to log A/B testing data and conversions
features.UseABTesting();
...
});
...
}Register A/B testing logging scripts onto all pages by calling the ABTestLoggerScript extension method in views.
@using Kentico.OnlineMarketing.Web.Mvc
@using Kentico.Web.Mvc@* Registers scripts that ensure logging of analytics data for A/B tests *@
@Html.Kentico().ABTestLoggerScript()Enabling the UseABTesting feature ensures that the system registers routes that process A/B testing logging requests. The logging itself (conversions and other related data) is performed by client scripts added to pages by the ABTestLoggerScript extension method.
The site now logs conversions and other analytics data for A/B tests. For example, Page visit conversions are logged when a visitor views a page and the following conditions are fulfilled:
A/B tests evaluate page variants by tracking the actions of visitors who view the tested page. These actions are known as conversions.
By default, the following types of actions can be tracked as conversions (no further code adjustments are required):
If you wish to track other types of visitor actions as conversions, developers can register custom conversion types and log conversions from any location within the site's code. See Logging custom A/B testing conversions.