Test an advanced condition
Sitecore Personalize enables you to test a condition by running it against a selected guest. This topic describes how to test an advanced condition that includes a header or parameter in the experiment or experience request.
When you test a condition, Sitecore Personalize tests the JavaScript on the server-side. This ensures that the JavaScript is validated within the context it will be executed in.
Team members with a User, Developer, or Admin role in Sitecore Cloud Portal can test an advanced condition.
To test an advanced condition:
-
Open the condition and click Test.

-
In the Test Condition dialog, you must test the condition against a guest. You can test against the default guest's attributes, or click in the search box and choose Recent to select from a list of recently active guests or Bookmarks to select from a list of bookmarked guests. The system selects a guest who was recently active. You can search for a guest using, for example, an email address, other unique identifier or browser ID.
NoteIf there is a guest whose data you often use when configuring or testing code, just click the star icon to bookmark the guest so you no longer have to search for them.
-
Click the Experience request option to include headers and parameters for an experiment or experience in the test. To do this, call the
requestcontext in the JavaScript code editor: -
To add a header to the experience request, you must include the header in the JavaScript in the code editor. For example, the out-of-the-box Device condition includes the
User-Agentheader in the JavaScript, as shown here: -
From the Test Scenario option, click Add Header.
-
You can include objects as keys using this format:
objects.keys. For example,User_Agentis the key andMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 Edg/112.0.1722.58is the value as shown here:
-
Click Test. The parameters and values you added to the test scenario are included in the response.
-
To add a parameter to the experience request, you must include the full path to the parameter in the JavaScript code editor, as shown here:
-
From the Test Scenario option, click Add Parameters.
-
You can include objects as keys using this format:
objects.keys. For example,utm_campaignis the key andsummer_saleis the value as shown here:
-
Click Test. The parameters and values you added to the test scenario are included in the response, as shown here:
