More in this section
Blogs RSS feed

Content Personalization Using Custom Criteria

by Bilyana Ivanova

Delivering personalized content to specific target audiences is a powerful way to attract website visitors and promote the right content to the right people, at the right time. This is how you can display products of regional interest to localized target groups, maybe display time-limited promotions to various user segments or highlight search-keyword related content for people that reached your website using these in a search engine. These are very typical scenarios that you expect to be covered by any system, capable of delivering content personalization. However,  whenever we want to deliver personalized content for user segments, defined by some criteria that are not so trivial – for example customer ranking in your CRM or membership in groups, we hit a roadblock, as usually we are expected to use the built-in functionality only. Or at least that’s the case if you’re not using Sitefinity.

With the personalization feature Sitefinity brings the ability to deliver personalized content, targeted to specific audiences (user segments) based on certain criteria: location, profile fields, previous purchases, etc. You can build complex logical expressions in order to define precisely the audience you want to deliver your message to. And while the built-in criteria options will cover many scenarios, in case you need something custom, you still have that option to add a new criterion.

In my previous blog post I demonstrated how you can Integrate Sitefinity with SalesForce CRM. Now, in order to demonstrate implementing custom criteria, we will pull the rating of a lead in our CRM system (SalesForce). Our goal could be to show hot leads a promo code to give them that final push they need, before they place an order.

In order to add a custom criterion you need to:

  1. Create a dialog/editor for that criterion, where users will set its expected value (SalesForceRatingEditor.ascx). 

    In our case we need a simple drop-down with the possible lead rating values: hot, warm, cold. Set the Build Action for the *.ascx file to Embedded Resource.

  2. Create another editor for the personalization console (the “view website as” page), where you can test how the site will come up if the criterion is met and if it is not. We can also reuse the editor we already have (SalesForceRatingEditor.ascx) and simply hide the label and leave visible only the input fields.
  3. Create a resource file for the editors (CustomPersonalizationResources.cs). It should inherit from Telerik.Sitefinity.Localization.Resource. We need an entry for the criterion’s name and for  the labels and values appearing on the editors. 

    We can then reference those elements on the editors like this:

    <label class="sfTxtLbl" for="profileTypes">
                {$<LocalizationResource>, <ResourceEntry>$}

  4. Create an evaluator, which will determine whether the  currently logged user matches the criterion or not (SalesForceRatingEvaluator.cs). It implements the ICriterionEvaluator interface, i.e. the IsMatch method. As an input we get the value of the criteria set for the user segment and also the context of the request.
  5. Create the criterion. For that, we add an event handler for the Bootstrapper.Initialized event in the Global.asax file. Here we need to:
    1. Register the resource file
    2. Add a virtual path for the embedded resources (the editors)
    3. Create the criteria
    4. Register the evaluator for the criteria
  6. Finally, you can now use that criterion within your user segments

The source for the SalesForce personalization criteria sample is available for download from github.

If you’re looking for more info on the personalization feature in Sitefinity, we’ve prepared a whitepaper that explains its usage and benefits. You can review it here.


Leave a comment
  1. Andreicho Aug 21, 2013
    It would be very helpful if author could include screenshots and a video
  2. Bart Oct 22, 2013
    I'm wondering how you structured these changes inside the solution.  Is this a custom control or did you make a folder under the SitefinityWebApp project and just put all the files used in it?  I also think these are just code snippets for key parts, the example with complete files would be great.
  3. Andrei Apr 30, 2014
    It would be interesting to see an example of personalization based on devise used. Sitefinity already has devise detection but for some reason it is missing from the content personalization list.
  4. Chaitanya Sep 22, 2014
    Agreed with Andrei, devise based personalization is needed.
  5. Vesselin Sep 23, 2014
    I doubt Sitefinity detects the device. For its Responsive Design module it uses CSS3 Media Queries, there is no device specific detection
  6. David Jan 09, 2015
    By using the above example, in Step 4 i am trying to compare the session value in IsMatch function using HttpContext.Current.Session it always return null. Is there any way i can check with session value?
  7. sae Apr 07, 2018
    Klik Prediksibolatoday Online sekarang. Baca juga Jasa Arsitek kami. Kunjungi jasa seo murah kemudian.

    Leave a comment