Skip to main content
Skip table of contents

Recommendations

Use the Recommendations tag to take advantage of machine learning-powered recommendations for your content.

Recommendations Tag

For 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 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.

Recommendations trigger events when a recommendation or recommendation set is requested, served, viewed, or clicked. You can easily access them in Report Builder as an Events report, where you'd find any recommendation events with the following event types:

image-2023-12-15-11-25-10-418.png

Filtered Recommendation Tag

For 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.

For Example,

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

Filter operators (=, CONTAINS, NOT, AFTER, BEFORE, BETWEEN) 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 (=).

For Example,

{% recommendation dogs_or_cats | count:3 | filter: 'keywords', '', 'dogs'|'cats' %} 

This will filter to resources that contain either “dogs” or “cats” as a keyword.

{% recommendation only_red | count:3 | filter: 'color', '', 'red' %} 

This will filter to resources with the color field set to “red”.

Filtered Contains Tag

For Example,

% recommendation example-cars | count: 3 | filter: ‘resource-type', ‘=', ‘product' | filter: ‘brand’, ‘CONTAINS’, ‘General’ %}

For a list of resources, it’s similar:

For Example,

{% resources example-autos | count: 3 | filter: ‘resource-type', ‘=', ‘product' | filter: ‘brand’, ‘CONTAINS’, 'Motors’ | sort_field: 'start_date' | sort_order: 'asc' %}

The available operators for both of these in email are documented in the table below:

Operator

Description

’=’ (EQUALS)

Can also be empty quotes ‘'

‘CONTAINS’

Includes the provided value as a portion of the field value.

‘NOT'

Does not equal

'BEFORE'

Prior to the time period relative to the current date (3 days ago, 7 days from now, etc.)

Only works with valid date fields

'AFTER'

After a time period relative to the current date (3 days ago, 7 days from now, etc.). Only works with valid date fields.

‘BETWEEN’

Between two time periods relative to the current date (between 3 days ago and 7 days from now, etc.). Only works with valid date fields.

Read more about Operators.

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

  • The filter names are all dependent on the available resource fields. If a resource has an author, you can filter by it. If not, it doesn’t work.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.