Skip to main content

Displaying a recommendation strategy selector

When creating the template for a recommendation, you can define a recommendation strategy selector as a content option. The selector lists all the recommendation strategies available on the site and allows the user to select one strategy for a modification variation.

The following figure shows an example of a recommendation strategy selector in the content options UI of a variation.

Recommendation strategy selector in a content options UI
Figure: Recommendation strategy selector in a content options UI

To display a recommendation strategy selector:

  1. In the template content options schema, define a content option for the selector. For example:

    {
    "properties": {
    "strategy": {
    "type": "string",
    "title": "Recommendation strategy"
    }
    }
    }
  2. In the template content options UI schema, set the selector to be rendered as a RecommendationStrategySelector widget.

    {
    "strategy": {
    "ui:field": "RecommendationStrategySelector"
    }
    }

When you select the template for a modification variation, the content options UI of the variation will display a recommendation strategy selector.

For more information about defining a content options UI, see the content options schema and content options UI schema documentation in Creating and editing a template.