Leveraging Product Recommendations

Recommendations are made up of the best selling, most viewed, and newest products across your entire catalog as defined by your customer's purchase behavior.

Our recommendation algorithm predicts what products your customers are most likely to buy next and intelligently serves these items in your email creative. We've made it very easy to recommend products based on browse activity and cart data to help you increase your CTR and revenue per email.

Configuring Recommendations

We've made it very simple to manage your recommendations in the application via your Account Settings.

There you will be able to configure the following:

  1. Aggregation Timeline (days back): This setting allows you to manage the timeframe which the app should consider in order to define your catalog's top sellers.

  2. Products to Exclude: this setting is useful for suppressing items that you do not want to recommend.


Aggregation Timeframe

This setting helps us determine the timeframe you'd like to use for your product recommendations.

The default is All Time where we look at your all-time products. You are able to change this setting to a more fitting timeframe depending on your business type and product catalog.

So for example, if you would like your top_sellers recommendations to reflect the last month only, you should select the timeframe of Last Month to make sure that we're injecting the overall top sellers of the last 30 days.

After making your selection you will need to save your recommendation settings.

Excluding Products

You can suppress certain items that you do not wish to feature in your recommendations.

  1. Go into the Product Exclusions section of your Recommendation Settings.

  2. Start by typing the product product_id (SKU) you wish to suppress. A list of available items under the product_id you type in the search will populate to help you make a selection.

    You can either select from the list or add a product to the suppression list by typing the product_id. Note that the list is case-sensitive.


The product information of the items you suppress will be visible in your Excluded Products list. You can always click on the x next to the product tag in order to remove the product from the suppression list.



The product exclusion feature will only auto-populate for products that have been viewed.

  1. Once your suppression list is ready, you'll need to save your recommendation settings. Otherwise, you will lose your changes.

Extract Product IDs/Categories

Products are generally injected into the template as a list of items, whether that comes from recommendations, cart items, or viewed items. There are several additional filters and tags which accept a comma-separated list of product ids or categories.

To allow for using these lists of items as parts of these filters, the following two filters are available:

  1. extract_product_ids
  2. extract_categories

These can be used like so:

Example Usage

# Get the site top sellers from the same categories as the customer's cart items:
{% recommendations "top_sellers" use_cart=True as top_sellers %}

# Get items viewed together with items the customer viewed, excluding the top-sellers from the previous recommendations:
{% recommendations "viewed_together" use_browsed=True exclude_product_ids=top_sellers|extract_product_ids|join:"," as viewed_excluding_top_sellers %}

Recommendation Taxonomies

Product recommendations have different types, which we will refer to as "taxonomies." Below is a listing of the types available, their definition, and their type usage.

TaxonomyParameter ValueDescription
Top Sellers"top_sellers"Injects the top selling products from your entire catalogue or from specified categories.
Most Viewed"most_viewed"Injects the most viewed products from your entire catalogue or from specified categories.
Purchased Together"purchased_together"Injects products that are frequently purchased together with specified products.
Viewed Together"viewed_together"Injects products that are frequently viewed together with specified products.
New Products"new_products"Injects recent products filtered by a timeframe or setting.

Recommendations Template Tag

The recommendations template tag is very flexible and powerful and should be able to provide you with the ability to insert some recommended products based on your specifications. The template tag has one required parameter which is the taxonomy as described in the section above.

Additionally, the template tag should always end with as VARIABLE_NAME. The variable name can be whatever you want, however, the recommendations tag will not be able to be used without it.

Basic Example: Global Top Sellers

{% recommendations "top_sellers" as recommended_items %}

After including the above tag in your template, you are now able to include data from recommended products documented in the Template Tag Attributes section.

Additionally, the recommendations tag takes several options that are not required, but provide enhanced capabilities.


Keep scrolling to the right of the table below for more option details

use_cartFor Top Sellers and Most Viewed:
only include products in the same categories as the customer's cart items.

For Purchased Together and Viewed Together:
Only include products purchased or viewed together with the customer's cart items.
True/FalseFalse (Default)
use_browsedFor Top Sellers and Most Viewed:
Only include products in the same categories as the customer's viewed items.

For Purchased Together and Viewed Together
Only include products purchased or viewed together with the customer's viewed items.
True/FalseFalse (Default)
exclude_cartExclude the customer's cart items from the recommended items.True/FalseTrue (Default)
exclude_browsedExclude the customer's viewed items from the recommended items.True/FalseTrue (Default)
exclude_product_idsExclude specific product_ids (SKUs) from the recommended items.Comma separated list of product IDs"SKU-01,SKU-02"
exclude_categoriesExclude products with the specified categories from the recommended items.Comma separated list of categories"gifts,clearance"
categoriesOnly include products with the specified categories from the recommended items.Comma separated list of categories"category,name"
categories_andQueries for products containing ALL categories. If False; filters products with at least one of the categories passed in categoriesTrue / FalseFalse (Default)
product_idsFor Purchased Together and Viewed Together, include products related to these specific product_idsComma separated list of product IDs"SKU-01,SKU-02"
countThe number of recommended products to retrieveNumber3 (Default)
days_backInjects products that are active in the past days_back daysNumberSetting (days_back)
price_aboveFilter products whose price is bigger than the value price_aboveNumber
price_belowFilter products whose price is lower than the value price_bellowNumber

Complex Examples:

# Top Sellers in the same categories as cart items
{% recommendations "top_sellers" use_cart=True as recommended_items %}

# Products Purchased Together with cart items, including products the customer viewed
{% recommendations "purchased_together" use_cart=True exclude_browsed=False as recommended_items %}

# 6 Most Viewed Products in a specific category excluding a specific product id
{% recommendations "most_viewed" categories="vip-items" exclude_product_ids="super-vip-item" count=6 as recommended_items %}

Template Tag Attributes

The recommendations tag above registers an array of products into the variable name you defined in the template tag (as VARIABLE_NAME). Each of these products have the following attributes that you are able to insert into your template. The table below assumes you have a product in the variable item by doing something similar to the following:

{% recommendations "top_sellers" as recommended_items %}
{% for item in recommended_items %}
Use {{ item.TAG }} here...
{% endfor %}
name{{}}Product Name
price{% display_currency item.price %}Product Price
product_url{{item.product_url}}Product URL
image_url{{item.image_url}}Product Image URL
description{{item.description}}Product Description
categories{{item.categories}}Array of Product Category Names
product_id{{item.product_id}}Product ID (SKU)

Using Recommendations in Email Creative

Strict Injection Method

In order to establish a rigid structure, you need to know the number of items you want to inject. Then, you will start counting your items from zero. Next, you'll add the order of the product within the structure of your recommendation tags—which you can see below.


Create your recommendation sections as Snippets. That way you can re-use your recommendations code in more than one email creative.

Simple example of a recommendation tag:


Again, the listing of recommended products starts with zero so you can use the logic below to further structure your recommendations.

Sequencing Examples:

// First Item

// Second Item

// Third Item

Usage and Process

  1. First you want to select your recommendation type. In this example, we'll use purchased_together.

    We will also be injecting 4 recommendations and because we're hardcoding the structure, we want to use an if statement with the correct tag type and index of product in order to only inject the structure when the recommendation exists.

Start of Conditional

{% if recommendations.purchased_together.0 %}
2. Next, we want to add the merge tags/product information we want to show. We'll start by injecting the image:
<img style=”max-width: 104px; border: none;” src=”{{recommendations.purchased_together.0.image_url}}” alt=”{{}}” />


You will want to make sure that we add a maximum width to the images. You may also want to add the product name in the alt="" property.

  1. Next, we want to add the name below the image:
  1. Next, we want to hot-link the image and the product name to the product page like so:
<a href=”{{products.purchased_together.0.product_url}}” target=”_blank”>LINK TEXT HERE</a>
  1. Lastly, we want to close the if statement using the tag below:

End of Conditional

{% endif %}

Since we're implementing a rigid structure, you'll want to repeat the steps above for every item you want to inject. So if you want to inject 4 items, you'll repeat these steps four times.

Purchased Together and Viewed Together

These recommendation_type's require a mandatory option product_ids in order to work. Since we want to show a relation of products we need to specify a base on product_ids.

Purchased/Viewed Together:

{% recommendations "purchased_together" product_ids="prod1-SKU,prod2-SKU" as related_products %}
  {% for product in related_prodcuts %}
  {% endfor %}

Example of End Result:

Fail-Safe Scenarios

Though our application's recommendation algorithm will match other product recommendations to a product, there will be times where we can't generate a match.

These are edge cases such as when the item to match is a new addition to your product catalog. We recommend implementing a fail-safe via a conditional regardless of the method you use to structure your recommendations.

For example, if you were to recommend Products Frequently Purchased Together and your customer added a new product in your catalog to their cart. There's a chance this new product may no trigger any recommendations. Therefore, the best scenario is to substitute the purchased_together recommendations section with top_sellers.

You can easily do this via a basic conditional that states that if there are matches for X recommendation taxonomy, show these, else replace recommendations with Z taxonomy.

Note that fail-safe usage is only applicable when recommendations are using the following taxonomies:

  1. Products Viewed Together
  2. Browsed Category Top Sellers
  3. Products Frequently Purchased Together
    4.Category Top Sellers


It is highly unlikely – if not impossible – that Rejoiner won't generate recommendations for your Overall Top Sellers. For that reason, we recommend using the top_sellers taxonomy as your go-to fail-safe.

Below you will find steps to create a fail-safe conditional that will automatically switch the recommendation taxonomy in order to guarantee that your recommendations section is bullet-proof.

The code below can be used as a guide for fail-safe usage. In this example, we're going to substitute purchased_together items with top_sellers if there are no matches.

Fail Safe Structure Example:

<!-- START Fail Safe Conditional -->
//If there are purchased_together recommendations
{% if products.purchased_together %}


// Else, if there are no matches, show top_sellers
{% else %}

{% endif %}
<!-- END Fail Safe Conditional -->

In the end you will end up with something like the example below:

Note: You must make sure that each section uses the correct structure as delineated by the Strict Injection Method steps above.

Another option is to completely hide the whole recommendations section if there are no matches. To do this you will just need to add the first part of the conditional statement and the closing tag to end the statement so that it reads like:

Fail Safe Structure Example:

<!-- START Fail Safe Conditional -->
//If there are purchased_together recommendations
{% if products.purchased_together %}


{% endif %}
<!-- END Fail Safe Conditional -->

Excluding Injected Items

There will be times where you do not want to include products that may have been injected in another section of your email—like the products your customer abandoned—in the recommendations. To avoid scenarios like these we use exclude filters.

To learn more about exclusion filters and how to use them go to this tutorial .