Skip to main content

Personalization logic

Uniform converts personalization rules into a format that can be executed on the CDN. This section describes how personalization logic is described and executed. The process entails two parts.

Part 1. Determining which rule matches#

Uniform finds all the personalized renderings, and for each rendering, determines which of the rules assigned to the rendering matches. Each rule consists of:

  • Condition - This describes the things that must be true in order for the rule to match. For example, a condition might consider the date or time, previous visitor activity, values in the query string, etc.
  • Action - This describes what content to display if the condition is true.

Uniform generates logic that is executed on the CDN that generates the Edge Context. When the CDN runs the logic to generate the Edge Context, a variable named ESI_CONTEXT_personalization_rules is created.

This variable is a dictionary that consists of a key and value:

  • Key - The id of the rendering with personalization rules assigned.
  • Value - The id of the rule that matches the.

Part 2. Rendering the output associated with the rule#

Uniform wraps each rendering that has personalization rules assigned to it with the following logic:

If rule X matches for rendering Y, show content Z.

Uniform generates logic for each rule assigned to the rendering. You can see this logic if you view the output from Sitecore without using a CDN. It will look something like the following:

$(ESI_CONTEXT_personalization_rules{'RENDERING ID'})=='RULE ID'

The following describes the components of this syntax:

  • ESI_CONTEXT_personalization_rules is a dictionary variable.
  • 'RENDERING ID' is the index into the dictionary.
  • $(ESI_CONTEXT_personalization_rules{'RENDERING ID'}) is the syntax used to read the value of the variable.
  • == is the operator.
  • 'RULE ID' is the value to compare to the variable value.
tip

This syntax for accessing variables and describing conditional logic is defined in the ESI language specification.