The Sitecore CDP/Personalize team has been on a streak of innovation recently. In just the past few weeks, we’ve seen several highly anticipated features, such as Copy Tenants and Custom Host Names. However, the feature I’m most excited about is Session Traits (well, that and CloudSDK for XP would be my top two). This functionality streamlines application of Implicit or Behavioral Personalization, along with many other valuable use cases. I had the opportunity to experiment with it this week, and it took almost no time to configure my first use case – a true testament to the efficiency of Sitecore CDP/Personalize’s modern architecture.

What Are Session Traits?

Session Traits enable businesses to capture and organize core customer behavioral data over time. This data can be utilized for calculations based on the most recent session while also providing access to information from previous sessions, events, and event attributes. The results of these calculations are stored in the guest’s profile at the end of each active session. This feature provides deeper insights into customer behavior and preferences, facilitating streamlined segmentation and personalized marketing efforts.

How Session Traits Can Be Utilized

In CDP:

Audience Creation and Segmentation: Similar to Sitecore XP Personalization, session traits enable the creation and segmentation of user profiles. For instance, using methods like the Euclidean distance formula allows for more accurate user attribution based on the user’s behavioral traits (e.g. page views, document downloads, CTA interaction and more)

Data Standardization: This feature simplifies and standardizes data calculations within the platform, reducing the need to send data to external systems for processing.

In Sitecore Personalize

Personalizing content: Tailor content or product recommendations based on previous behaviors, such as promoting items a customer liked or hiding previously dismissed promotions.

Facilitating decision-making: Create decision models to offer the next best action based on a customer’s past interactions, preferences, or behaviors, increasing conversion chances.

Simple use case

Handling Acceptance of Terms and Conditions:

This process captures and records the user’s acceptance of terms and conditions, including the acceptance date. To improve the user experience, the terms screen is displayed only once across all touchpoints. By leveraging Sitecore CDP’s Traits capabilities, we can overcome the limitations of Sitecore Personalize alone, such as the 100 events, 90-day duration, and 40-session restrictions, by storing the acceptance directly within Traits.

This is the only code we need to create in Developer Center -> Session Traits:

(function () { 
load("classpath:utils.js");
// exit execution if value is set
if(guest.traits.session.policy.value == "Yes"){
    return;
}
	if (guest.sessions) { 
	    var sessions = guest.sessions;
	    if (sessions[0].events) {
	        var events = guest.sessions[0].events; 
	        for (var i = 0; i < events.length; i++) { 
		        if (events[i].type == 'view:Policy' ) {
			       	return "Yes";
		        }
	        }
	    }
	}

The return of the above method is stored in User Profile, under Session Traits section:

We can now leverage this data to create a Terms and Conditions personalized banner. To achieve this, establish a condition or decision model in Sitecore Personalize to check the policy value, which will determine whether the Terms and Conditions banner should be shown.

Condition Function: 
(function () {
 if(guest.traits && guest.traits.session.policy.value =="Yes") return true;
return false;
})();

Understand limitations

While Session Traits offer powerful and new functionality, there are a few key limitations to keep in mind:

Applicable Only to Identified Guests: Session traits are calculated only for customers who have been identified, not anonymous visitors.

Web Sessions with Closed Status: Calculations are performed at the end of closed web sessions, with no processing during active sessions.

Profile and Tenant Limits: Each guest profile can contain up to 10 session traits, and tenants are restricted to a total of 10 session traits, which may be active or paused.

Event and Order Data Limits: Sitecore CDP processes up to 2000 events from a session and considers the last 40 orders within a 90-day period.

Retry Mechanism: In case of failure, Sitecore CDP will attempt up to 10 retries before marking the session trait as a failure. Traits with high failure rates will automatically be paused.

Data Size Constraints: The JSON representation of each session trait cannot exceed 1000 characters.