Sitecore Analytics: Display content by relevance using profile cards

For this post to make sense I will need to create a user story. I will not try to create a standard scenario instead I will create a scenario that is easy to understand and easily applicable to this post.

The problem we want to solve is to present some content to the user that is relevant to the content that the user is looking at in any given time.

Scenario: You are building a site for the Law university. The site contains an archive of cases, that are categorized by the law branch they are part of : criminal, financial, tax, company, family law etc.

Let’s assume that each case from these categories has a presentation page. (sorry i do not have screenshots but this is an imaginary scenario). Each of these cases has one or more profile cards assigned to it.

Somewhere on the presentation page of a case you want to show a list of cases that are similar to the one you are currently reading about.

What you need to do is to assign profile cards to the sitecore items that you want to filter by relevance. Then you simply get all the cases and sort them by relevance.

This method gets all the cases that are related to the current one, and orders them by relevance. The GetRelevance method looks like this:

One item can have multiple profile cards. We need to compare all of them:

The get profile card distance returns the Euclidian Distance between the two profile cards:

 

 

I have written this code about two years ago and only now i share it so, if this post is not clear enough i will try to make a demo site and post code and sitecore package.

 

Alin Parjolea

Alin Parjolea

System Developer at Pentia. I have been involved in small and large scale projects using Sitecore and .Net for the last 4 years. I am Sitecore certified developer since 2009. I have a Master degree in Computer Science from University of Southern Denmark. More detailed info about me can be found on my Facebook and LinkedIn pages.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*
Website