I was asked
by a customer to add "Country" to User Profile criteria as it was not
in the dropdown list.
![]() |
User Profile dropdown list |
I haven't
used Visitor Groups before and was a bit surprised that that the values in the
dropdown list were shorter than expected. I thought the list was populated from
Personalization in EPiServer and could be configured in SqlProfile in
web.config.
![]() |
profile section i web.config |
Just to be
sure I added a value to SqlProfile and it appeared in the dropdown list after a
reload. So my first thought was right, but what had happened with the removed
values? I now suspected that EPiServer for some reason or another had chosen to
filter the list. Loading up episerver.dll in dotPeek revealed the truth. In the
initializing code the class added an ignore list and the missing values where
added to the ignore list. The next question was how to enable those values.
After contact with EPiServer support they provided me with an easy way to
control the ignore list.
The way to
do it is to call the criterion in global.asax.cs, I used application_start.
Here are some examples:
1. To remove all values in the list, e.g. show all values:
protected void Application_Start(Object sender, EventArgs e)
{ EPiServer.Personalization.VisitorGroups.Criteria.UserProfileCriterion.IgnoreUserProfileProperties.Clear();
}
2. To remove a specific value, e.g. show "Country":
protected void Application_Start(Object sender, EventArgs e)
{ EPiServer.Personalization.VisitorGroups.Criteria.UserProfileCriterion.IgnoreUserProfileProperties.Remove("Country");
}
3. To add a specific value, e.g. hide "FirstName":
{ EPiServer.Personalization.VisitorGroups.Criteria.UserProfileCriterion.IgnoreUserProfileProperties.Add("FirstName");
}
This should be useful for hiding the values that make no sense for creating Visitor Groups, just as EPiServer did with their default values. Although I think they probably removed some useful values, like "Country".
The complete list of default properties are:
IgnoreUserProfileProperties.Add("SubscriptionInfo");
IgnoreUserProfileProperties.Add("CustomExplorerTreePanel");
IgnoreUserProfileProperties.Add("FileManagerFavourites");
IgnoreUserProfileProperties.Add("EditTreeSettings");
IgnoreUserProfileProperties.Add("ClientToolsActivationKey");
IgnoreUserProfileProperties.Add("FrameworkName");
IgnoreUserProfileProperties.Add("ZipCode");
IgnoreUserProfileProperties.Add("Locality");
IgnoreUserProfileProperties.Add("Language");
IgnoreUserProfileProperties.Add("Country");
No comments:
Post a Comment