---
title: "Using personalization"
slug: "using-personalization"
abstract: "Describes using the Search and Recommendation API for Sitecore Search to personalize results for a user based on their search history and past interactions."
---
# Using personalization

To personalize results for a visitor, use the `widget.items.search.personalization` object. You must add the `fields` that you want Sitecore Search to prioritize when looking for similar items and the algorithm you want to use. Also, pass the [`uuid`](https://doc.sitecore.com/search/en/developers/search-developer-guide/integrating-using-rest-apis/using-a-uuid-to-track-site-visitors.html "Using a UUID to track site visitors") so that Sitecore Search knows which visitor must get personalized results.

> [!note]
> Before you can use an attribute for personalization, make sure that an administrator configures the attribute for **Personalization** in Search.

For the data model of this object, see the [Search and Recommendation API reference](https://doc.sitecore.com/search/en/developers/search-and-recommentation-api/index.html).

In the following example, you want to:

- Show personalized results for the keyphrase **cloud**.
- Ask Sitecore Search to use the title and type of content when it searches for similar content. To do this, use the `fields` array within the `personalization` object and pass `title` and`type` as values.
- Use the `affinity` algorithm to get personalized content.

The following code sample shows how to create a request:

```JSON
{
    "widget": {
        "items": [
            {
                "rfk_id": "rfkid_7",
                "entity": "content",
                "search": {
                    "content": {},
                    "personalization": {
                        "fields": [
                            "title",
                            "type"
                        ],
                        "algorithm": "affinity"
                    },
                    "limit": 10,
                    "offset": 0,
                    "query": {
                        "keyphrase": "cloud"
                    }
                }
            }
        ]
    },
    "context": {
        "locale": {
            "country": "us",
            "language": "en"
        },
        "user": {
            "uuid": "159871551-m7-17-44-1p-c0ya4nb69t8o0iho2eia-1667926756185"
        }
    }
}
```