Cookies and personalization information

With Discover, you can pass many attributes with your request to personalize the user experience. You do this through The context request object and its nested Context type objects. To get a successful response, you must pass cookies in the header.

Note

While all other personalization attributes other than cookies are optional, we strongly recommend that you pass as many context values as possible. This is so that Discover can present the most personalized experience possible to your users.

The following table lists a few of the context attributes you can pass.

Parameter

Description

uri

Uri of the page the user is requesting.

referrer

Referring uri you received as part of the header in the request.

ip

IP address of the request you received from the user's browser or native application.

user_agent

User agent of the browser that you received in the header of the request.

cookie

Pass these in your request header.

These are cookies that Discover sets on the your domain. All cookies start with __r , that is, two underscore characters, followed by the letter r.

These cookies are required to:

  • Track the user session.

  • Preview settings if you want to change the configuration in the Customer Engagement Console and test its impact on the website before publishing it.

  • Ramping up traffic on your website when moving to Sitecore Discover from another vendor.

uuid or user_id

When you pass the cookies, you usually also pass the __ruid. This ID contains the anonymous user ID that Sitecore Discover has generated if a beacon was included in your website. In this case, passing uuid is optional. If you have not included a beacon, you must pass the uuid that you have generated and maintain it to track the user anonymously.

In the following sample request, you ask for a widget with specific page, user, geo, and browser contexts:

RequestResponse
{
   "context": {
       "page": {
           "uri": "/category/men/shirts?color=red",
           "referrer": "https://riggsandporter.com/category/men?color=red"
       },
       "user": {
           "uuid": "125757321-ph-eb-4w-1p-tvfxk0rs1iwgp5tsgdvt-1523635809203"
       },
       "geo": {
           "ip": "20.230.240.14"
       },
       "browser": {
           "user_agent": "user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36"
       }
   }

Do you have some feedback for us?

If you have suggestions for improving this article,