12

Background:

One of our clients has contracted us to create a "siloing" feature on their site, using personalization. Basically, a visitor would come to the site and optionally self-identify as a particular type of professional. Each type of professional is associated with a single profile key and pattern card. If a user self-identifies as a particular type of professional, the visitor is scored to the max value of the associated profile key. Should the visitor re-identify as a different type of professional, the old identification is completely cleared out (set to the minimum value) and the new data is scored to the max.

Question:

This is the first time that I have had to set profile key values to a maximum or minimum. In Sitecore, I have set the maximum to 0 and the minimum to 100 for each of the profile key items that I have created. I know that these items do not control the profile key items that I am scoring in the code, but if in the code I set the scores to float.MinValue and float.MaxValue for minimum and maximum, respectively, will this cause an issue down the line for reporting?


Side-note:

The client does not intend to do any reporting/analytics based on this "siloing" feature. If they decide to add that in the future, we will add additional personalization events that do not get cleared out to the feature.

  • Why don't you just score 0 / 100? Or get the actual min/max values from the profile definition items? – Dmytro Shevchenko Oct 6 '16 at 13:09
  • I currently at scoring 0/100. The thing is that the min and max is on the profile key items, which you don't have when looping through all keys on a profile. That's why I changed the implementation to have each role point to a profile key. I am just looking to see if there is a better way. – Zachary Kniebel Oct 6 '16 at 13:11
  • Would it help if I provided code that would get the minimum and the maximum allowed values for each profile key of a given profile? – Dmytro Shevchenko Oct 6 '16 at 13:14
  • Actually, let's back up for a second. I think I know where your (or mine) confusion comes from. Will write up an answer. – Dmytro Shevchenko Oct 6 '16 at 13:20
7

Background

The way in which you are using visitor profiles is non-standard, so I will first explain some details about the internals of the feature.

Once you've defined a set of profile keys, some pattern cards and profile cards, you would normally assign profile cards to your website pages. Every time a user visits a page that has an associated profile card, Sitecore will go over profile key values of the card and add the non-negative values of profile keys to the user's profile. There are two important conclusions:

  1. The max value of user profile values is virtually unlimited and is not related to the max value of the corresponding profile key.
  2. Profile values are not supposed to be negative.

When a user is matched to a pattern card, the matching process considers the user's profile and all available pattern cards into points in an N-dimensional space, where N is the number of defined profile keys. The profile is translated into a point based on the profile type (Sum, Percentage or Average).

Whichever pattern card point has the smallest Euclidean distance to the user profile point, that pattern card becomes the user's new matched pattern that will be used in personalization rules from that point on.

Recommendation

You are not using Sitecore's profile scoring feature, instead you override the profile to have specific values. Only one profile key will have a value greater than zero—both in the pattern cards and in the visitor profile. Which is why it doesn't really matter what values you use for the non-zero key.

I recommend that you put 0 to all profile keys and 1 to the one that you want to be matched to a specific pattern card. This is the simplest and least error-prone solution that will definitely work in your case.

| improve this answer | |
  • You are right - this is a very non-standard use of the feature, and I'm not a particular fan of it, but I understand why they want to do it. I am currently following your recommendation and it looks like that is the best way to go. Thanks so much for your explanation! – Zachary Kniebel Oct 6 '16 at 14:58
  • 1
    @DmytroSchevchenko also pointed out that the way to implement this is using the RollbackValues method on the Profile class. Not quite sure how I missed that guy, but that's the way to go about zeroing out the scores. Thanks, man! I'd upvote you again, if I could ;) – Zachary Kniebel Oct 7 '16 at 15:42
2

In addition to @DmytroSchevchenko's answer, I want to provide a little extra insight into the code required to actually implement this.

As Dmytro mentioned, profile values are not supposed to be negative, and in fact the OOTB Profile class' Score() method checks to make sure that each score value is >= 0.0 and will only apply the score if it is. As such, a new class will need to be created to extend the Profile class and override the OOTB Score() method (which is virtual).


UPDATE:

Based on comments from Dmytro, I realized that rather than override the Score method, I can continue following the same pattern that Sitecore took with the Profile class' methods, and instead add a new RollBackScore method that is public and accepts an IEnumerable<KeyValuePair<string,float>> as a parameter. This is because the OOTB RollBackScore method that accepts the same parameter is unfortunately private.

| improve this answer | |
  • I don't understand why you would need to extend Profile. Do you want it to allow negative values? There's no benefit in that whatsoever. – Dmytro Shevchenko Oct 7 '16 at 9:05
  • @DmytroShevchenko looking at the Score method on the OOTB Profile class, the code only applies score values >= 0.0. It then adds the passed in values to any existing value for the associated key. This makes sense, as far as standard personalization goes, but we want to actually clear/zero out existing score values. I don't want to have negative values after scoring, but I want to be able to pass a negative value to the Score method so that I can reduce the existing value. Again, the client asked for this very non-standard form of personalization and they don't intend to report on it. – Zachary Kniebel Oct 7 '16 at 15:10
  • @DmytroShevchenko when I am next by my computer, I will add my overriding Score method to this post. – Zachary Kniebel Oct 7 '16 at 15:12
  • I see now. Have you considered using Profile.RollBackScore()? – Dmytro Shevchenko Oct 7 '16 at 15:23
  • @DmytroShevchenko - I actually just looked at it and remembered why I didn't go that route - I couldn't actually call the RollBackScore method with updated values and the RollBackValues method is private. What I should do, is actually extend the Profile class to include a public method for RollBackScore. I will update my answer. – Zachary Kniebel Oct 7 '16 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.