Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This Developer Center contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

Personalization Configuration

Personalization Configuration

Introduction

Personalization refers to offering different pricing, promotions or content based on the shopper's attributes, known as traits. For example, an item's price may only be discounted for shoppers who are over sixty five years old. Personalized pricing is also referred to as Dynamic Pricing or Differential Pricing.

How Cortex Processes Traits

Cortex uses Subjects to manage its users. When a user logs in with an access token, a Subject is created and exists for the duration of the request. Personalization traits are modelled as attributes on the Subject and are called SubjectAttributes. If you have access to the Subject, then you also have access to the user's traits.

Subject Lifecycle

The Subject is created by the SubjectLifecycleFilter which assembles the Subject from HTTP inputs including the role, scope, and the user's identity details. This filter takes the traits sent through the x-ep-user-traits HTTP header and adds them to the subject's attributes. Subject attributes are automatically added to the Commerce Engine Selling Context and can influence pricing, promotions, and dynamic content delivery.

Cortex internally infers traits using SubjectAttributeLookups that contribute additional SubjectAttributes to the Subject. As with the x-ep-user-traits HTTP header, the SubjectAttributes are automatically added to the Commerce Engine Selling Context and can influence pricing, promotions and dynamic content delivery.

The image below describes an overview of the Subject's lifecycle.

Configurations

How to turn the traits header on and off

You can disable the subject attributes traits header at deploy time or runtime by undeploying or removing the ep-rs-authentication-header-epcommerce bundle. The SubjectAttributeLookupStrategy responsible for processing the traits header is dynamically loaded at runtime, or never loaded if it is removed from the deployment package (WAR). Once this bundle is disabled, the traits header is ignored and doesn't affect Cortex resource requests.

How to configure the traits header size

Your Cortex application may require large amounts of personalization information in the traits header and the default header size (8K) may not be large enough. To increase header size, use the configurations provided by your web server. Changes are not required in Cortex to handle larger headers.