Unlocking New Possibilities with Sitecore CDP's "Session Traits”
Enhance customer insights and personalization through advanced engagement tracking
Start typing to search...
Sitecore's Customer Data Platform (CDP) now includes Session Traits, an effective method for improving audience segmentation, personalization, and decision-making. This feature streamlines the usage of customer data for tailored experiences and marketing tactics by enabling companies to compile events and customer data across web sessions, carry out custom computations, and save the findings within visitor profiles.

Session features are characteristics that are obtained from a customer's actions during a single online session. They give businesses the ability to record behavioral data in real time, such how many pages are browsed or how many goods are placed to a basket. Custom session attributes can be defined to compute significant metrics at the conclusion of each session using logic based on JavaScript. To help businesses customize future experiences, a trait may, for instance, track the number of times a particular product category was seen or record if a promotion was rejected.
In order to create a session trait, we must have access to the Developer center navigation item. Clicking Session traits will take us to the area where we can see existing and create new Session traits.

Once there, let’s create a new session trait and give it a simple name.

Now we’ve been taken to a more familiar screen. On the left, we can add our JavaScript logic that will be used to calculate and assign the session trait. And one the right we can Activate it (there by making it active) and add or modify additional details about the session trait and how it might be used.

Imagine a retail website that wants to track how many promotional banners a customer interacts with during their session. You could define a session trait like this:
(function () {
var promotionEngagementCount = 0;
// Check for promotion interactions
triggerSession.events.forEach(event => {
if (event.type === "CLICK" && event.arbitraryData.bannerType === "Promo") {
promotionEngagementCount++; // Increment for each engagement
}
});
return promotionEngagementCount; // Return total engagements with promotions
})();
This code counts how many times promotional banners were clicked in a session. When activated, this session trait provides insights into user engagement and can inform marketing strategies.
With this in place, at the end of the user’s session, the engagements are totaled and summarized for that user. At most, we can have 10 session traits active at any one time.
Once defined, session traits are stored in the guest’s profile as attributes. Here’s how the data might look:
{
"email": "[email protected]",
"guestType": "customer",
....
"traits": {
"session": {
"promotion_clicks": {
"name": "Count of Promotion Banner Clicks",
"createdAt": "2024-02-07T09:21:57.764Z",
"value": 5,
"modifiedAt": "2024-02-07T09:24:13.295Z"
}
}
}
}
Using session traits to track promotional banner engagement not only enhances your understanding of customer interactions but also informs data-driven marketing strategies.