Using custom fields in an interactive experiment


Overview of how to use custom fields in an interactive experiment (Sitecore Personalize).

There might scenarios when you need to use logic in a web experiment that relies on an attribute that Sitecore Personalize does not capture. For example, you might want to only run an experiment for visitors who are logged in to your organization's website. Since this is not automatically captured by Sitecore Personalize, you can create a custom field called “loggedInState”, and use this data when you build the experiment.

You can use custom fields when using the following features:

  • Composing the API response: Include the custom field in the API response, using FreeMarker. For example, retrieve the value of the custom field and use it in further logic.

  • Creating real-time audiences: Use the value of the custom field to determine whether to execute the experiment.

  • Creating programmable decisions: Use the custom field as logic in a programmable decision to determine the next best action or offer.

You can send any custom field in the POST request using the Sitecore Personalize REST API. You must use the params key as shown in the following example:

      "loggedInState":"logged in"


Avoid using custom fields throughout your business logic

As a general rule, separate your business logic so that you do not use the same custom field in logic within a real-time audience, decisioning, and API response unless necessary.