Kentico Xperience 13 documentation and ASP.NET Core

Most documentation about running Xperience applications under ASP.NET Core can be found in a dedicated section: Developing Xperience applications using ASP.NET Core. The rest of the documentation still applies, but some code samples and scenarios might need slight modifications for Core projects.

Certain pages allow you to switch between Core and MVC 5 content using a selector located under the page heading.

All major differences between the MVC 5 and Core platforms are summarized in Migrating to ASP.NET Core.

×

Enabling A/B testing

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.

Default cookie level or consent requirements

The A/B testing functionality uses cookies 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 system only tracks A/B testing page variants to keep content consistent, and does not log any conversions.

To learn more about cookies and consents in Xperience, see:

Enabling A/B testing

To configure your website so that it allows A/B testing:

  1. Open the Settings application in the Xperience administration interface.
  2. Click the On‑line marketing category in the settings tree.
  3. Select your Site in the site selector (or enable A/B testing globally).
  4. Select the Enable A/B testing check box.
  5. Click Save.
On this page

Enterprise license required

Features described on this page require the Kentico Xperience Enterprise license.

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:

  1. Open your MVC project in Visual Studio.

  2. 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();
      
          ...
      }
  3. Register A/B testing logging scripts onto all pages by calling the ABTestLoggerScript extension method in views.
    • Call the method in your MVC website's main layout (and any other used layouts) to ensure that the scripts are available for every page.
    • The logging scripts run asynchronously, so we recommend adding them at the end of the <head> tag in the page code.
    Required namespaces
    @using Kentico.OnlineMarketing.Web.Mvc
    @using Kentico.Web.Mvc
        @* Registers scripts that ensure logging of analytics data for A/B tests *@
        @Html.Kentico().ABTestLoggerScript()
    
  1. Open your live site project in Visual Studio.

  2. Edit your application's startup class (Startup.cs by default).
  3. 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();
    		...	
    	});
    
    	...
    }
  4. Register A/B testing logging scripts onto all pages by calling the ABTestLoggerScript extension method in views.
    • Call the method in your website's main layout (and any other used layouts) to ensure that the scripts are available for every page.
    • The logging scripts run asynchronously, so we recommend adding them at the end of the <head> tag in the page code.
    Required namespaces
    @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:

  • The visitor has previously viewed a page with a running A/B test.
  • The given A/B test is configured to track a conversion of the Page visit type, and the conversion's Page URL value matches the current page.

Conversion tracking

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):

  • Form submission
  • Newsletter subscription
  • Page visit
  • Product added to shopping cart
  • Purchase
  • Purchase of a specific product
  • User registration

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.


Was this page helpful?