Hide Episerver Visitor Group Criteria


I am currently on Episerver 11.6 and am looking to start using the personalization in Episerver.

Creating custom Criteria classes is very simple. I've created several of my own, but would like to hide some of the built in ones. Is it possible to hide specific built in personalization criterias?


Jun 05, 2019 21:29

Hi Paul,

These are just resolved through dependency injection, in fact, if you look at the VisitorGroupCriterionAttribute you can see it implements the ServicePlugInAttributeBase.

That means that ejecting the registered instances should make them unavailable. It's not that obvious how to do this via StructureMap, but I quickly tested the following and it seems to work (no guarantees!):

public class RemoveVisitorGroupCriteriaInitialization : IConfigurableModule
    public void Initialize(InitializationEngine context) { }
    public void Uninitialize(InitializationEngine context) { }
    public void ConfigureContainer(ServiceConfigurationContext context)
        // If you wanted to remove all criteria

        // Remove selected criteria
        var criteriaTypes = new List<Type>
            // Site Criteria
            // Time and Place Criteria

        var criterionPluginConfig = context.StructureMap().Model.PluginTypes
            .SingleOrDefault(x => x.PluginType == typeof(ICriterion));

        if (criterionPluginConfig == null)

         var instances = criterionPluginConfig.Instances.Where(x => criteriaTypes.Contains(x.ReturnedType));

        foreach (var instance in instances)


Edited, Jun 06, 2019 22:40

This is extremly helpful and is exactly what I wanted. Thank you!

Jun 07, 2019 13:28
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.