Sitecore: How to change the personalisation trigger page count

One of Sitecores features is the ability to assign profile cards or profile key scores to pages. As visitors browse the website the profile key scores from each page are added to the visitors profile. Visitors are then assigned a pattern card using N-Dimonsional Euclidean Distance to calculate the closest matching pattern card to the visitors profile.

However before a pattern card is assigned to a visitor they must visit a minimum number of pages. The default for this is set to 3.

Reasons for changing this could be that you actually want to be more certain of a users profile before triggering personalisation this could be to avoid visitors landing pages on the site heavily dictating which persona they initially become profiled as, which in turn could influence personalisation that keeps them in that persona.

Or it could be because you want to lower the number of pages for a more immediate effect.

Whatever the reason to change the default from 3 you need to add the following setting to your config:

 <setting name="Analytics.Patterns.MinimalProfileScoreCount" value="3"/>

Extending personalisation options using the SBOS Accelerator

SBOS Rules Editor

A few weeks ago I blogged about extending profile matching over multiple visits in Sitecore. The basis of the post was to look at options on how you could extend Sitecore so that personalisation could use historical persona data rather than just data from the current session.

In this post I’m going to be looking at the SBOS Accelerators module which lists as one of its features “Historical Conditional Renderings”.

So what does it do?

Rather than change the way data gets recorded about a user, the SBOS Accelerator adds an additional 5 personalization rules to the rule set editor. These are:

  • where the specific campaign has been triggered within x days
  • where the specific goal has been triggered within x days
  • where behavior based on last x days matches the specific pattern card in the specific profile
  • where the specific page has been visited within x days
  • where the value of specific profile key compares to specific value, based on behavior from last x days

As well as allowing a rule to look at profile data over a number of days, the days option can also be changed to look at profile data over a number of visits.

This option of allowing us to specify a number of days or a number of visits helps to overcome the issue of data needing to degrade at different rates over time. We can set rules to promote something that a user may still be interested in by limiting the data to the last week, or we can target personality traits that shouldn’t change by taking a few months into consideration.

What’s important to note though is profile data is still being recorded on a per visit basis, so we still don’t have an overall accumulation of points over time and an assigned pattern card is still being based on an individual visit. But we’re able to create rules based on pattern cards assigned in multiple visits.

Some things to note

The SBOS Accelerators are currently only available for Sitecore versions 6.6 – 7.2. It currently hasn’t been updated to work with the new Mongo based analytic’s db in 7.5+.

The module has been written by Sitecore Support and is marked as being tested by Sitecore, so you can expect a decent level of reliability. However it is not covered by your Support agreement with Sitecore so you may not get any help with issues you encounter. The source for the module is available for you to edit though.


SBOS Accelerators on the Sitecore Marketplace

Basic Personalisation with Sitecore

One of my favourite features of Sitecore is the ability to personalise content to match your visitors. Being able to update content based on user actions makes a much better experience for your sites visitors by helping to target content they want, and hiding the content that they don’t.

It’s also really easy to set up using filters similar to what you may already be familiar with from creating rules to direct emails in outlook.

In the video below from the Master Sitecore channel on YouTube, Martina shows how to change a donate content block on a charity site, to one focused on spreading the word about the charity once someones donated.

Sitecore: Extend profile matching over multiple visits

In Sitecore, to gain a better understanding of our visitors interests we have the ability to define Profile Keys and Cards to tag our content with. As our visitors navigate through the site, this data is used by Sitecore to build a profile of the visitor. A pre-defined Pattern Card that most resembles the visitors profile is then assigned to the visitor which can be used as the basis of selecting the content that should be displayed on a page for that visitor.

However what this doesn’t do is carry the visitors profile over multiple sessions. Each time a visitor comes back to the site within a new session, the visitors profile key values are reset back to zero.

So what’s Sitecore actually doing?

Before working out how to carry this information between visits, lets look at how a profile is actually being created.

If we look in the Profiles table within the Analytics database we can see the profile data that’s been recorded for a visitors visit.

Sitecore profile data

The Pattern Values column contains the current profile key scores for each key the visitor has a score for. e.g.


If the visitor was to visit a page which has scope score of 5 and background score of 10 these values would be added to the visitors current key scores. e.g.


When a pattern card is assigned, the card with the closest shape of keys is chosen. e.g. If the visitor has a high value for background and low value for scope they will be assigned a pattern card with similar proportional key values.

How do we extend this over multiple visits?

So the easiest way to carry the visit information from one visit to the next would be to simply copy the profile key values from the last session to the next. The code for this would look similar to the following:

var currentVisitIndex = Tracker.CurrentVisit.VisitorVisitIndex;
if (currentVisitIndex <= 1 || !Tracker.CurrentVisit.Profiles.Any())

var previousProfiles = Tracker.Visitor.GetVisit(currentVisitIndex - 1, VisitLoadOptions.All).Profiles;

foreach (var profile in previousProfiles)
    var currentProfile = Tracker.CurrentVisit.GetOrCreateProfile(profile.ProfileName);


    foreach (var ProfileKey in profile.Values)
        currentProfile.Score(ProfileKey.Key, ProfileKey.Value);


Now the visitors profile is how it was when they left and crucially we can use this data to personalize the sites homepage for the visitor.

So why shouldn’t we do this?

As simple as this is, it comes with one potentially massive downside. If we go back to the way the profile values are built up they key values are essentially just being accumulated. Each time the visitor visits an item with a background score of 10, the visitors background profile key score in increased by 10.

Our visitors are humans going through different stages of there life, with constantly changing jobs and interests. There’s nothing to ever reduce a profile keys score other than the fact everything is normally zeroed on each visit. By copying the data from the last visit on the start of the next this would never happen and the profile key’s will continue to count up forever. The key value obtained from an item viewed 2 months ago would counted as just as important as the value from another key viewed on an item today.

So if you were running a travel site and a visitor looked at summer holidays for 3 weeks they will have a profile highly weighted towards summer holidays. If they then started to look at winter holidays we wouldn’t want them to have to look at winter holidays for 3 weeks just to have an even likeness of summer and winter.

Overcoming this issue isn’t so simple and largely depends on your business needs. If your visitors interests could change each week then you need something that will degrade the old visit data values quickly. Whereas if your trying to differentiate between people that are in a 2 week vs 6 month buying pattern, you need to retain that data a lot longer.

Some things we can do when copying the data from the visitors previous profile though could include:

  • Halving the profile scores, or reducing by a different factor. This would reduce the importance of values obtained on previous visits. So if a visitor received a 10 on the first visit, it would be worth 5 on the second, 2.5 on the third etc
  • Look at the date of the last visit. Is it to old to be relevant still or can we use the age to determine what factor we should reduce the scores by
  • Look at a combination of multiple last visits to establish what the recent scores were

All these ideas though need to be used on conjunction with what your trying to profile. If it’s age then you know people are going to get older. If it’s an interest that will change frequently then you know the data needs to degrade quickly, but if it’s male/female then that doesn’t necesserally need to degrade at all.

Pragmatically add request tracking for an item in Sitecore

Sitecore’s Engagement Analytic’s engine automatically tracks all page requests. When you assign profile cards to items this also triggers data about a persons interests to start being built up against their visit record, which can then be used to create a personalized site experience.

However what if you want items that are not pages to also contribute to a users profile?

This scenario came about with a recent site we took over that the client wanted to add personalisation too. The site (for unknown reasons) had been built with one product page which looked at a querystring parameter to determine the product information to be displayed (the querystring format was hidden from end users through the use of a URL rewrite). Product data was being stored as Sitecore items allowing them to have profile cards assigned, but as the item was never visited the profile cards values were never applied to the users profile.

After a bit of searching through the Sitecore.Analytics.dll I stumbled across the TrackingFieldProcessor class. This class contains a process function that takes an item parameter an in turn triggers all the functionality for processing campaigns, profiles and events related to the item.

To use it your code would look like this:

Sitecore.Data.Database db = Sitecore.Configuration.Factory.GetDatabase("web");
(new TrackingFieldProcessor()).Process(db.GetItem(new ID("395BDEF7-16CB-4C94-B9B6-A6EAC148401F")));

This will cause the profile key values to be updated but in the visitor history it still looks like the visitor was only looking at the one page. To change those values we can do this:

VisitorDataSet.PagesRow rawUrl = Tracker.CurrentVisit.GetOrCreateCurrentPage();
rawUrl.Url = "new url value";
rawUrl.UrlText = "new url value";

Note: I was unable to find any documentation on these functions, or any official way of doing this. Use at your own risk!