Unlocking New Possibilities with Sitecore CDP's "Session Traits”

Enhance customer insights and personalization through advanced engagement tracking

November 12, 2024

By David Austin

Unlock Deeper Insights and Personalization with Sitecore’s New Session Traits

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.

Screen showing customer properties with empty fields for session traits, contact information, and additional information.

Session Traits: What Are They?

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.

Important Use Cases for Session Traits

  1. Improved Segmentation: Companies can classify clients according to their actions, such as determining which users are most likely to make a purchase or which ones are most likely to peruse a specific category. Audience segmentation becomes more dynamic and focused with this capacity.
  2. Creation and Export of Audiences: Custom audiences can be made using session characteristics, and these audiences can be exported and activated for specific campaigns inside and outside of Sitecore CDP.
  3. Personalized Customer Journeys: By filtering promotions that the user has already rejected or displaying just previously liked things, session attributes enable businesses to present the most pertinent offers and content. As a result, user interactions become more relevant and unique.
  4. Data Standardization: Businesses can guarantee uniformity in the tracking and utilization of values across campaigns by automating the computation and archiving of session data. This reduces manual interventions and enhances data dependability.

Let’s Create a Session Trait

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.

Developer Center menu with "Session traits" highlighted as a new option.

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.

Popup window for creating a new session trait with fields for name and ID.

Example: Tracking Engagement with Promotions

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.

Storing Session Traits

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.

Image of Fishtank employee David Austin

David Austin

Development Team Lead | Sitecore Technology MVP x 3

David is a decorated Development Team Lead with Sitecore Technology MVP and Coveo MVP awards, as well as Sitecore CDP & Personalize Certified. He's worked in IT for 25 years; everything ranging from Developer to Business Analyst to Group Lead helping manage everything from Intranet and Internet sites to facility management and application support. David is a dedicated family man who loves to spend time with his girls. He's also an avid photographer and loves to explore new places.