Dynamic Filters

Boomtrain University
BME Guide

Dynamic Filters


Boomtrain has introduced the ability to include very powerful filters in your BME dynamic content. This means that individual sections within an email can now be customized even further.


Filters are inherently risky. Though they are sometimes necessary, using very strict filters will ultimately limit Boomtrain’s ability to provide great personalized results. Use them at your own risk!

Also, while we always try our best to support filters requests, we may be forced to ignore these filters in order to provide enough dynamic recommendations. If you have permanent filter needs that will not change, contact Boomtrain Support to set up global filters. Also, we encourage you to contact Support to make sure your filters are set up correctly. If you’re unsure, don’t hesitate to reach out.

How it Works

Section Specification

In the body of an email that will use filters, each section of an email should be defined with a tag as follows:

{% recommendation <section_name> | count: <num> | filter: ‘<name>’, ‘<op>’, ‘<value1>|<value2>|…’ | … %}

Section Specification ExamplesEach filter will be combined with other filters. The <op> stands for ‘operator’. Leaving it blank will default to ‘equals’. Pipe-separated values combine multiple filters using ‘OR’ statements.

// Returns 5 articles that are of resource type “article” and contain either “featured” or “promoted” in the “category” field.
{% recommendation featured_and_promoted_articles | count: 5 | filter: ‘resource-type’, ‘, ‘article’ | filter: ‘category’, ‘, ‘featured|promoted’ %}

// Returns 10 resources that have both “dogs” and “cats” in the keywords field.
{% recommendation dogs_and_cats | count: 10 | filter: ‘keywords’, ‘, ‘dogs’ | filter: ‘keywords’, ‘, ‘cats’ %}

// Returns 2 resources that have a pubDate in the last 7 days.
{% recommendation this_week | count: 2 | filter: ‘pubDate’, ‘AFTER’, ‘-P7D’ %}

// Returns 5 resources that are not of the ‘event’ resource type.
{% recommendation non_events | count: 5 | filter: ‘resource-type’, ‘NOT’, ‘event’ %}

// Returns 5 resources that have “region” either “global” or equal to the user’s user_region attribute
{% recommendation local_or_global | count: 5 |filter: ‘region’,’,’global|{{user_region}}’%}

Upon rendering, section specification tags are replaced with the empty string and will therefore not render. To be safe, it is likely best to comment out the tags:

{% recommendation non_events | count: 5 | filter: ‘resource-type’, ‘NOT’, ‘event’ %}
{% recommendation this_week | count: 2 | filter: ‘pubDate’, ‘AFTER’, ‘-P7D’ %}

Dynamic Merge Tags

When an email contains a section specification tag as above, merge tags take a new syntax in the following format:


where <section_name> is the name specified in the section specification; <index> is the index of the recommendation (starting at the first recommendation in index 0), and <field> is the dynamic field to insert as text.

The dynamic merge tag format you may be used to ( {{rec.<resource-type>.<index>.<field>}} ) is still available, but should only be used when no filters are required.

Merge Tag Examples

// Returns the title of the first featured_and_promoted_articles.
{{ featured_and_promoted_articles.0.title }}

// Returns the thumbnail src of the 2nd recommendation in the this_week section.
{{ this_week.1.thumbnail }}

// note this will need to be inserted into an <img> tag to render the image.
<img src=”{{ this_week.1.thumbnail }}” />

Never miss a growth opportunity