Context parameters for conditions

Important

Feature availability is part of a phased rollout. Your organization may not see this functionality yet. It will become available when your environment is included in the rollout.

The following sections detail the types of context parameters you can include when creating a condition.

We recommend you familiarize yourself with the types of parameters and elements for conditions, as well as unsupported JavaScript functions, before you add any context parameters to conditions.

Guest parameters

The guest object contains parameters about the site visitor. When you use JavaScript in a custom condition, you can check for the presence of a value from the guest object. For example, you can check the site visitor's guest type, which is the level of identity Sitecore Personalize has determined for the site visitor.

You can also include guest parameters that non-technical users can assign values for when adding a condition to an experiment or experience. For example, the user can select which language the guest uses, as a condition for showing the experiment or experience.

The Compatibility column in the table lists the types of experiments and experiences for which the parameter is compatible. You can use parameters from the guest object in all types of experiments and experiences.

To use parameters from the guest object in a condition, include the full path to the guest parameter in the JavaScript editor. The full path is provided in the Parameter column of this table:

ParameterTypeCompatibilityDescriptionExample
guest.languagestringweb, interactive, triggeredThe language used by this guest, represented by 2 letters, in ISO 3166-1 alpha-2 format."EN"
guest.emailstringweb, interactive, triggeredThe email address of the guest."[email protected]"
guest.titlestringweb, interactive, triggeredThe title of the guest."Ms."
guest.firstNamestringweb, interactive, triggeredThe first name of this guest."Dave"
guest.lastNamestringweb, interactive, triggeredThe last name of this guest."Jones"
guest.genderstringweb, interactive, triggeredThe gender of this guest."unknown"
guest.citystringweb, interactive, triggeredThe city address of the guest."Dublin"
guest.countrystringweb, interactive, triggeredThe country of this guest, represented by 2 letters, in ISO 3166-1 alpha-2 format."IE"
guest.nationalitystringweb, interactive, triggeredThe nationality of the guest."Irish"
guest.dateOfBirthdateweb, interactive, triggeredThe date of birth of this guest.2001-02-15T00:00
guest.passportExpirydateweb, interactive, triggeredThe expiry date of the guest's passport.2023-08-01'T'00
:00.000'Z
guest.typestringweb, interactive, triggeredThe level of identity obtained for the guest."customer"
guest.firstSeendateweb, interactive, triggeredThe first time the guest interacted with your brand."2015-01-01T16:17
.000Z"
guest.lastSeendateweb, interactive, triggeredThe last time the guest interacted with your brand."2023-04-06T16:17
.000Z"

UTM and referrer parameters

The experience request service returns parameters from the site visitor's real-time session. When you use JavaScript in a custom condition, you can check for the presence of a value from the experience request service. For example, you can check the site visitor's point of sale.

You can also include session parameters that non-technical users can assign values for when adding a condition to an experiment or experience. For example, the user can select which UTM campaign is associated with the site visitor's URL, as a condition for showing the experiment or experience.

To ensure Sitecore Personalize calls the experience request service and returns the parameters when evaluating the condition, include this function in the JavaScript editor:

(function () {
        return { request: request };
})();

The Compatibility column in the table lists the types of experiments and experiences for which the parameter is compatible. You can only use parameters in a condition that are compatible with the same types of experiments and experiences.

To use parameters from the experience request service in a condition, include the full path to the request parameter in the JavaScript editor. The full path is provided in the Parameter column of this table:

ParameterTypeCompatibilityDescriptionExample
request.pointOfSalestringweb and interactiveThe point of sale associated with the session."myretailsite/ireland"
request.params.referrerstringinteractiveThe referrer associated with the session."facebook.com"
request.params.utm.campaignstringinteractiveThe UTM campaign included in the visitor's current URL."content_promotion"
request.params.utm.sourcestringinteractiveThe UTM source included in the visitor's current URL."bing"
request.params.utm.mediumstringinteractiveThe UTM medium included in the visitor's current URL."social"
request.params.utm.contentstringinteractiveThe UTM content included in the visitor's current URL."call_to_action"

Tenant parameters

The tenant object contains parameters from your organization's tenant settings that are set in the Company Information screen. When you use JavaScript in a custom condition, you can check for the presence of a value from the tenant object. For example, you can check if the tenant's currency is EUR.

Warning

The parameter values set in the Company Information screen and returned in the tenant object are not necessarily identical to the parameters that your organization sends to the Sitecore Personalize APIs.

The Compatibility column in the table lists the types of experiments and experiences for which the parameter is compatible. You can only use tenant parameters in a condition that is compatible with interactive experiments and experiences.

To use tenant parameters in a condition, include the full path to the tenant parameter in the JavaScript editor. The full path is provided in the Parameter column of this table:

ParameterTypeCompatibilityDescriptionExample
tenant.configurations.dateFormatstringinteractiveThe date format that displays on the Personalize UI."1985-12-24"
tenant.configurations.namestringinteractiveThe name of the tenant."My Retail Site"
tenant.configurations.timeZonestringinteractiveThe time zone of the tenant."Europe/Dublin"
tenant.configurations.currencystring

(uppercaseĀ ISO 4217)
interactiveThe alphabetic currency code of the currency in which monetary values display in the Sitecore Personalize UI."EUR"
tenant.configurations.languagestringinteractiveThe primary language set for the tenant."en-gb"
If you have suggestions for improving this article, let us know!