Tuesday, 20 October 2015

Behavioural Profiling Improvements in Sitecore 8.1

Sitecore 8.1 is released this week and with it comes a couple of major improvements to the behavioural profiling system. This post makes an initial exploration of these new features and the mechanics underpinning them.


Persistent Profiles

Behavioural profiling has been a part Sitecore for a long time. As a person navigates through your site they accumulate scores against various predefined profiles that give an indication of their content preferences. This allows marketers to personalize a their experience, which is obviously great. But it's always been difficult to retrieve and use that data when they come back to the site at a later date. You basically have to start from scratch with each new session. However, as of Sitecore 8.1, a contact's profile scores persist across sessions out of the box. Your personalisation rules can pick up right where they left off.

Sitecore have managed to fit this new feature in quite neatly with the existing structure of the application, and have provided the usual handy extension points. Here's an overview of the pipelines/processors involved in persisting profiles:

Pipeline: initializeInteractionProfile
Processor: ResetProfiles
The ResetProfiles processor runs before a contact's historic behavioural profile data is loaded, and ensures that their current Interaction is cleared of any profile data.

Since the initializeInteractionProfile pipeline runs at the very beginning of a session, I'm not actually sure why there would be any profile data already in the Interaction object. But it looks like ResetProfiles provides a bullet proof way of ensuring it can't happen.

Pipeline: initializeInteractionProfile
Processor: CopyProfiles
The CopyProfiles processor in the initializeInteractionProfile pipeline transfers any pre-existing profile data from the current contact in to the new Interaction object at the beginning of a session. 

Don't confuse this with the processor of the same name in the initializeInteractionProfile pipeline (see below), which effectively does the opposite job at the end of the session.

Pipeline: commitSession
Processor: UpdateContactBehavorProfiles
This processor runs at the very end of a session, and simply runs updateContactBehaviorProfile pipeline.

Pipeline: updateContactBehaviorProfile
Processor: CopyProfiles
updateContactBehaviorProfile is a new pipeline with a single processor - CopyProfiles. It transfers profile data from the current session's Interaction object to its corresponding Contact object. 


Profile Decay

It's great that a contact's profile scores now persist between sessions, but that raises a new problem. Of course I want Sitecore to remember my past behaviour, but the pages I viewed three months ago are not as important for personalization as the ones a viewed today. That why Sitecore 8.1 introduces the concept of profile decay - a way to gradually reduce the relevance of scores accumulated in the past.

Profiles items now have a "Decay Rate" field which specifies the percentage by which a contact's profile score should decrease at the start of each interaction. Let's say that I end my session with a Trend Setter profile key score of 100. If the decay rate value is 0.75, then next time I return to the site my Trend Setter score will reduce to 25.  

Profile decay is applied via a new pipeline with a single processor:

Pipeline: initializeInteractionProfile
Processor: ApplyDecay
After a contact's profile has been loaded in to the current interaction, the ApplyDecay processor implements the decay algorithm. It converts the percentage value supplied in the Decay Rate field and converts it into a number between 0 and 1.

n.b.The standard value for the "Decay Rate" field is 0, so it's effectively disabled by default.



Sitecore 8.1 has a new a lot of great new features, so the behavioural profiling improvements might go relatively unnoticed. But in my opinion they're a welcome addition, and will significantly improve personalisation within Sitecore.