---
title: Creating a personalized page - example
related:
  - https://docs.kentico.com/k10/on-line-marketing-features/configuring-and-customizing-your-on-line-marketing-features/configuring-content-personalization/personalizing-web-parts-and-web-part-zones.md
  - https://docs.kentico.com/k10/on-line-marketing-features/managing-your-on-line-marketing-features/content-personalization/setting-display-conditions-for-personalization-variants.md
  - https://docs.kentico.com/k10/on-line-marketing-features/managing-your-on-line-marketing-features/contact-management/tracking-contact-activities.md
  - https://docs.kentico.com/k10/on-line-marketing-features/configuring-and-customizing-your-on-line-marketing-features/on-line-marketing-macros.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

> **Info:** **Kentico EMS required**
>
> Features described on this page require the **Kentico EMS** license.

The example on this page describes how to create an advanced personalized page step-by-step. The personalization scenario leverages [Contact management ](https://docs.kentico.com/k10/on-line-marketing-features/managing-your-on-line-marketing-features/contact-management.md)features in order to display different content for each visitor according to the actions they previously performed on the website. Specifically, the example demonstrates how to modify the default _Products_ page on the sample Corporate site so that it displays a targeted list of products based on the keywords that visitors enter into the website's search.

## Creating the first product list variant

The following example uses the sample Corporate site.

1. [Enable content personalization](https://docs.kentico.com/k10/on-line-marketing-features/configuring-and-customizing-your-on-line-marketing-features/configuring-content-personalization.md).
2. Open the **Pages** application and select the **Products** page in the page tree.
3. Switch to the **Design** tab, where you can see the zones and web parts that make up the content of the page.
4. Right-click the header of the **Featured products** web part located in the **Main zone**.
5. Hover over the **Personalization variants** option and click **Add web part variant**.

   ![Adding a web part variant to the page](https://docs.kentico.com/docsassets/k10/creating-a-personalized-page-example/adding_webpart_variant.png "Adding a web part variant to the page")
6. Enter the following values for the variant's properties:

   - **Display name**: Featured products - Smartphones
   - **Enabled**: Selected (leave it checked)
   - **Display condition**:

     ```text

     OnlineMarketingContext.CurrentContact.LastActivityOfType("internalsearch").ActivityTitle.ToLower().Contains("phone")
     ```

     > **Info:** **Macro details**
     >
     > This condition ensures that the page displays the variant only if the latest keyword searched by the current user contains the word _phone_, such as _smartphone_, _iPhone_ etc. The condition is composed of several macro methods and expressions:
     >
     > - The **LastActivityOfType** method retrieves the current contact's most recently logged [Activity](https://docs.kentico.com/k10/on-line-marketing-features/managing-your-on-line-marketing-features/contact-management/tracking-contact-activities.md) of the _Internal search_ type.
     > - The **ActivityTitle** property loads the title of the logged activity, which stores the exact text of the search phrase.
     > - The **ToLower** method converts the title to lower case (to make sure that the condition correctly recognizes search keywords with capital letters).
     > - The **Contains** method checks if the second parameter (i.e. the word _phone_) is located somewhere within the text returns the result.
7. Click **Save & Close**.

   - The configuration dialog for the variant's web part properties appears.
   - The variant automatically loads the property values from the original web part.
8. Change the following properties:

   - **Default -> Web part title**: _Featured products - Smartphones_ (allows you to identify which variant you are working with on the Design tab)
   - **Content filter -> Product public status**: (all)
   - **Content filter -> Page types**: _CMS.Smartphone_ (ensures that the web part only loads and displays smartphone products)

     ![Configuring personalization variant](https://docs.kentico.com/docsassets/k10/creating-a-personalized-page-example/configuring_personalization_variant.png "Configuring personalization variant")
9. Click **Save & Close**.

## Creating the second product list variant

1. Add another variant to the _Featured products_ web part by clicking **Add content personalization variant** () next to the slider.
2. Set the following properties for the variant:

   - **Display name**: Featured products - MS Windows
   - **Enabled**: Selected (leave it checked)
   - **Display condition**:

     ```text

     searchText=OnlineMarketingContext.CurrentContact.LastActivityOfType("internalsearch").ActivityTitle.ToLower();

     searchText.Contains("windows") OR searchText.Contains("microsoft") OR searchText.Contains("office")
     ```

     > **Info:** **Macro details**
     >
     > The macro loads the latest search keyword once (just like the first variant) and stores the value in the **searchText** variable. This avoids repeated loading of the activity data and improves performance.
     >
     > The condition checks the variable for three different words and is fulfilled if the system finds at least one of the keywords in the search text.
3. Click **Save & Close** to confirm the variant's properties.
4. Make the following changes to the web part's properties:

   - **Default -> Web part title**: Featured products - MS Windows
   - **Content filter -> Product public status**: (all)
   - **Content filter -> WHERE condition**: _SKUManufacturerID = 6_ (the web part variant only loads products that have _Microsoft Corporation_ set as their manufacturer)
5. Click **Save & Close** again to create the second variant.

There are now three different versions of the product list on the page.

## Result

To try out how the personalization works:

1. View the live site and sign out.
2. Enter _phone_ or any other text containing the word into the search bar on any of the website's pages (it is located in the header under the navigation menu).

   ![searching for phones on the website](https://docs.kentico.com/docsassets/k10/creating-a-personalized-page-example/searching_for_phones.png "searching for phones on the website")
3. Select the **Products** page from the menu.

![Smartphones displayed by a personalization variant](https://docs.kentico.com/docsassets/k10/creating-a-personalized-page-example/displaying_phones.png "Smartphones displayed by a personalization variant")

The page only displays smartphone products in the **Featured products** section.

You can test other possible search expressions and check how the content of the page changes. If the searched text does not match the conditions of either one of the created variants, the page shows the default list containing a random selection of featured products. If you log on to the site as a different registered user (e.g., user name _Andy_ with a blank password), this changes the current contact and the system displays the default version of the page until you search for an expression that matches one of the personalization variant conditions.

The result of the example is a personalized page that dynamically offers products that the visitor has shown interest in (by searching for related terms), rather than a random selection of products from the entire catalog. When setting up this type of personalization on your own website, you can create any number of variants with appropriate conditions according to your specific requirements and product catalog.
