Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
PersonalizeCloud Portal
Sitecore Personalize
        • Getting started
            • Using custom fields
        • Using traffic allocation and variant traffic assignment
        • Apply a condition
        • Apply a segment
        • Use a decision model
        • Run an experiment
    • SitecoreAI experiments
    • Using the experiment list
    • Manage experiment details
    • Set automated post-test actions
    • Set up email notifications
    • Duplicate, delete, and view details
  • Using client-side JavaScript
  • Glossary
  1. Sitecore Personalize
  1. Sitecore Personalize
  2. Introduction to experiments in Sitecore Personalize

Using custom fields in an interactive experiment

There might scenarios when you need to use logic in an interactive 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:

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

  • Creating custom conditions: 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:

{
   "clientKey":"abBah8aelipaPeebae7roox2tiexoSee",
   "channel":"WEB",
   "language":"en",
   "currencyCode":"EUR",
   "pointOfSale":"retailsite.com",
   "browserId":"56860bff-94ba-4d84-aa37-2b5a83d5411b",
   "friendlyId":"home_page_banner",
   "params":{
      "loggedInState":"logged in"
   }
}
Warning

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 custom condition, decisioning, and API request unless necessary.

If you have suggestions for improving this article, let us know!

© Copyright 2026, Sitecore A/S or a Sitecore affiliated company.
All rights reserved.

Privacy policySitecore Trust CenterTerms of use