---
title: Recommending documents to personas
related:
  - https://docs.kentico.com/k8/on-line-marketing-features/content-personalization/personas/defining-personas.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.

You can recommend different documents on a page based on current visitor's persona. For example, you can display different articles to a visitor assigned to a persona named **Patient** and different articles to a visitor assigned to a persona named **Foreigner**.

## To recommend content to personas

1. [Assign personas to documents](#assigning-personas-to-documents)
2. [Place a widget recommending the content](#placing-a-widget-to-recommend-content-to-personas)

   —or—
3. [Place a web part recommending the content](#placing-a-web-part-to-recommend-content-to-personas)
4. [Previewing content for different personas](#previewing-content-for-different-personas)

### Assigning personas to documents

By assigning personas to documents, you establish which documents you want the personas to see. You can either:

1. [Add personas to a single document](#to-add-personas-to-a-single-document)
2. Assign personas to multiple documents

#### To add personas to a single document

Consider adding different personas to the same document. The document's content may be appropriate for more than one persona.

1. Navigate to the document that you want to assign personas to.
2. Switch to the **Properties -> Personas** tab.
3. Click on **Add personas**. A **Select personas** dialog opens.
4. Select the personas that you want to assign to the document.
5. Click on **OK**. The system assigns the personas to the document.

You have defined which documents are appropriate for which personas. You can now use a widget or a web part to display personalized content on the document.

#### To assign personas to multiple documents

Consider adding different personas to the same documents. The documents' content may be appropriate for more than one persona.

1. In the **Pages** application, switch to **Listing**.
2. Filter the documents that you want to see.
3. Select the documents that you want to assign personas to.
4. In the first drop-down list under the listed documents, choose whether you want to perform the action on **Selected documents** or **All documents**.
5. In the second drop-down list, choose **Tag documents with personas**. A **Select personas** dialog opens.
6. Select the personas that you want to assign to the documents.
7. Confirm by clicking on **OK**. The system assigns the personas to the documents.

You have defined which documents are appropriate for which personas. You can now use a widget or a web part to display personalized content on the document.

### Placing a widget to recommend content to personas

1. Navigate to the page on which you want to recommend content.
2. On the page, open a widget zone's menu (). A Select widget dialog appears.
3. In the Online Marketing folder, select **Persona-based Recommendations**.
4. Click on **OK**. A **Widget properties** dialog opens.
5. Specify the widget properties. Hover over the properties to see their description.
   1. By default, transformations for displaying news articles and e-commerce products are available. Developers can create new transformations in the Personas.Transformation document type.
6. Confirm by clicking on **OK**.

Now, when a visitor assigned to a persona visits the page, the widget displays the documents for the particular persona.

### Placing a web part to recommend content to personas

1. Navigate to the page on which you want to recommend content.
2. [Place](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md#adding-web-parts) the **Persona-based Recommendations** web part on the page. A web part properties dialog appears.
3. **Select** the **Path** to the documents that the web part displays.
4. (Optional) **Select** the **Document types** that the web part displays. Not selecting any **Document types** makes the web part display documents from any **Document types**.
5. (Optional) Specify the **Select top N documents** field.
6. **Select** a transformation for displaying the content. There are two example transformations available in **Personas - Transformations**.
   1. By default, transformations for displaying news articles and e-commerce products are available. You can create new transformations in the Personas.Transformation document type.
7. (Optional) To increase performance, specify the **Columns** that are loaded for the displayed documents. Use only the columns that you load in your transformations.
8. (Optional) [Configure](#configure-how-the-persona-based-recommendations-widget-and-web-part-display-content) how the web part chooses the documents it displays.
9. Specify the rest of the web part properties.
10. Confirm by clicking on **OK**.

Now, when a visitor assigned to a persona visits the page, the web part displays the documents for the particular persona.

### Configure how the Persona-based recommendations widget and web part display content

By default, if there isn't enough tagged documents to display for the persona viewing the page, the web part displays other documents of the specified **Document types**. You can change the behavior so that only the tagged documents for the specific persona are displayed.

**To change which documents the web part displays:**

1. In the web part properties, remove the macro in the **ORDER BY expression**.
   1. The expression sorts documents so that tagged documents are displayed first. Untagged documents are displayed only if there isn't enough tagged documents to display.
2. Into the **WHERE condition** field, enter the following macro: _{% PersonaDocumentWhereCondition %}_
   1. The where condition ensures that only tagged documents are displayed. Note that the WHERE condition also loads documents faster than the default OrderBy macro.
3. Confirm by **OK**.

You have changed the behaviour of the widget/web part so that it only displays documents tagged by the visitor's persona.

> **Tip:** **Loading and displaying data**
>
> You can also refer to [Loading and displaying data on websites](https://docs.kentico.com/k8/developing-websites/loading-and-displaying-data-on-websites.md) for more general information on using repeaters in the system.

### Previewing content for different personas

Once you set up pages to display documents to personas, you can preview how each of the personas sees the content.

#### To preview content for different personas

1. Switch to the **Preview** tab of the page for which you created personalization variants.
2. Use the **Personas** drop-down list to choose the persona for which you want to preview the page.
3. Repeat the process for other personas.
