Setting display conditions for personalization variants

Kentico EMS required

Features described on this page require the Kentico EMS license.

When setting up personalized pages, the most important part of the process is to properly define the conditions that indicate when the system displays individual variants. You can build personalized conditions using the macro condition editor.

To edit the display conditions of the existing personalization variants:

  1. Open the Pages application and select the personalized page in the page tree.

  2. Switch to the page’s Properties -> Variants tab.

  3. Edit () the selected personalization variant.

  4. Specify the variant’s Display condition property.

    Configuring p

  5. Click Save.

See also: Example - Building a personalization condition

Alternatively, your developers can help you write conditions for virtually any type of scenario according to your specific requirements by utilizing macro expressions. Keep in mind that the result of a condition’s expression must be a logical (boolean) value. For more information about the available macro options, refer to the On-line marketing macros page.

Setting the priority of personalization variants

On the live site, the page displays only one variant for each personalized object. The system processes variants in the order of their priority and selects the first enabled variant whose condition is fulfilled in the given context.

By default, the priority of variants depends on the order in which they were created. You can see the current order on the personalization slider. Apart from the original object, which is always first, variants with a higher priority can be found further on the left of the slider.

Managing personalization variants

To change the priority of a page component’s variants:

  1. Click the Variant list button on the object’s personalization slider.
    • A dialog containing a list of the variants opens.

      Reorganizing personalization variants

  2. Reorganize the variants as necessary through the Up () or Down () actions.

The system now evaluates the conditions of the component’s variants according to the new order, starting from the top of the list.

Example - Building a personalization condition

The following example demonstrates how to build a condition using macro rules. The condition causes the page to display the given variant only during a specific part of the day, or to users with special authorization.

  1. Create a content personalization variant for an editor widget or a web part and web part zone.

  2. Click Edit next to the Display condition field in the variant properties dialog.

  3. On the Rule designer tab, select Current day time is in range in the list of available rules.

  4. Click Add rule ().

    • The selected rule appears in the condition.
  5. Add the Current user is in role rule.

  6. Click the and operator between the two clauses in the designer area. The operator changes to or.

  7. Click on the underlined parameters in the text of the rules and set the required time and role values.

    Designing a macro using the Rule designer

  8. Click Save & Close.

The condition builder inserts the variant’s display condition as a user-friendly expression composed of macro rule clauses.

Alternatively, your developers can help you enter the condition directly on the macro condition editor’s Code tab or in the variant’s Display condition field using K# macro syntax. For example:




(CurrentDateTime.Hour >= 9 && CurrentDateTime.Hour <= 17) || CurrentUser.IsInRole("GoldPartners")

This sample condition ensures that the variant is only displayed to regular users if the current time is between 9 a.m and 5 p.m.. Users who belong to the GoldPartners role can see the variant’s content at any time.