Recommendations

Overview

Taking advantage of machine learning-powered recommendations for your content can be achieved with the Recommendation tag.

Recommendations Tag

Example

{% recommendation articles | count: 3 %}

This tag creates a variable called ‘articles’ and assigns it an array of resource objects based on the entered count, in this case, three. The number of recommendations you retrieve should be the number of resources you will utilize in your content.

You can add the tag and the array created anywhere your content. The contents of the returned array can be can be viewed in content using {{articles}}, or you can populate the contents of the resources with the syntax {{articles[0].title}}.To narrow recommendations to specific types of resources or based on other metadata, you can add filters.

Filtered Recommendation Tag

Example

{% recommendation articles | count: 3 | filter: 'resource-type', '', 'article' %}

This tag includes a filter for the metadata of resource-type with a value of ‘article’.

Additional filters, such as user properties, can be added by separating them with a pipe.

Example

{% recommendation dogs_and_more | count: 5 | filter: 'keywords', '', 'dogs' | filter: 'keywords', '', '{{animal_preference_2}}' %}

Filter operators (After, Before, Between, Not) can be inserted as needed in the empty string after the name of the meta tag you want to filter on. An empty string (no operator specified) is treated the same as having equality.

Example

The filter {"name":"keywords", "values":["dogs", "cats"]} will filter to resources that contain either “dogs” or “cats” as a keyword.

The filter {"name":"color", "values":["red"]} will filter to resources with the color field set to “red”.

You can read more about Operators here.

Filtering could reduce the quality of personalization. The Recommendations engine will override the filter if it cannot retrieve the requested number of recommendations.