Is this really the version you are looking for? Kentico Xperience 8.2 Documentation is no longer updated. Use the switcher in the header to choose your product version.
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 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.
The following example uses the sample Corporate site.
Open the Pages application and select Products.
Switch to the Design tab, where you can see the zones and web parts that make up the content of the page.
Right-click the header of the Featured products web part located in the Main zone, hover over the Personalization variants option and click Add web part variant.
Enter the following values for the variant's properties:
Display name: Featured products - Smartphones
Enabled: Yes (leave it checked)
Display condition:
OnlineMarketingContext.CurrentContact.LastActivityOfType("internalsearch").ActivityTitle.ToLower().Contains("phone")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:
Click Save & Close.
Change the following properties:
General -> 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)
Click OK.
Display name: Featured products - MS Windows
Enabled: Yes (leave it checked)
Display condition:
searchText=OnlineMarketingContext.CurrentContact.LastActivityOfType("internalsearch").ActivityTitle.ToLower();
searchText.Contains("windows") OR searchText.Contains("microsoft") OR searchText.Contains("office")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.
Click OK to confirm the variant's properties.
Make the following changes to the web part's properties:
Click OK again to create the second variant.
There are now three different versions of the product list on the page.
To try out how the personalization works:
View the live site and sign out.
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).
Select the Products page from the menu.
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.