HTML Blocks


We have developed New HTML blocks , which is a more suitable and scalable solution. In the new version of HTML blocks it is possible to use a visual parameter editor or Jinja variables as parameters of the HTML block.

These existing HTML blocks will be automatically migrated in several phases during the following weeks, as described in the Migration plan.

When creating email templates, you usually need to reuse some parts of the HTML for headers and footers for example. Therefore, Bloomreach Engagement allows you to create custom HTML blocks (also called dynamic blocks, or dynamic content) that you can create once and then easily reuse across your email campaigns.

How to create an HTML block

You can create a new HTML block in in two ways:

  1. Go to Data and Assets > Asset manager > Blocks -> New block
  1. You can also create a new block directly within the email editors, whether you are building the email in the "Asset manager", "Email campaigns" or through an email node in a scenario. Use the (+) button at the bottom of the editor or node modal to open the Asset picker, select Blocks in the asset selector and choose the “New block” option.
  1. You can also use one of the predefined templates from the campaign asset picker.

Creating the content

When creating a new block, simply write the HTML code which you will want to reuse later. The functions available are similar to the normal email HTML builder, including multilingual support.

Inserting parameters

It is also possible to insert parameters into the block. Parameters allow you to insert a custom value within each email separately even when the block has been inserted as a "reference" (see below for explanation).

New parameters can be inserted into the code using the Template parameters functionality as illustrated below. Read more about using Template parameters.

[[ parameterName | default value ]]

Using the parameters will prompt the option to choose the value of the parameter when the block is selected within an email template.


Inserting HTML blocks into an email

Using the HTML editor

Click on the "plus" button in the bottom right corner of the editor as shown in the screenshots below. This button will open a modal with the asset picker for blocks and snippets. Selecting Blocks in the asset type will load available blocks from the Asset Manager. Note that if the campaign is a part of an initiative, it will only show assets from the same initiative, or assets marked as Global objects.

1459 1434

Selecting a block will open the block preview and parameters inputs in the top. When entering the parameters, the preview will be regenerated once you stop inputting values (click outside). After selecting and configuring the block, there are two ways of inserting it into your campaign.

  1. Copy as HTML
    This will take the full code from the default language template and copy it to clipboard. User can the simply paste the code into the desired HTML part. This code can be changed as desired, and will NOT be updated when the block is changed, neither will it consider language variants.
  2. Copy reference
    This will copy the reference to the block in jinja tags, that can be pasted into code. This will not allow changes to the code directly in the HTML and WILL be updated when the block is changed. You will only be able to edit the values of the parameters directly in your email HTML editor.

Please see also below how the block is seen in the HTML code. In the line 5 the block is copied as HTML, in the lines 6 and 7, the block is copied as reference:


Using the visual editor

Drag the "Dynamic content" into the canvas and then choose which block you want to insert.


Predefined templates

Predefined templates are created by Bloomreach and cover many different topics to help you create email campaigns using Blocks in a more efficient way. They are loaded in real-time from our central repository. Even though they are not stored in your project, you can use and edit them either by saving them as a copy into your project or by copying their code into the clipboard.



Project Templates

Project templates are your custom blocks which you created in your project. However, when you edit the predefined templates, they would be considered as project templates too.

You can use predefined templates directly from the campaign asset picker. There are two cases on how to use them whether the templates contain parameters or not.

  1. In case the template contains parameters, you must first save the block into the project templates via “Save as copy” and then select its project copy to be able to use it in the campaign.
  2. In case the template does not contain any parameters, you can either use the project template copy via “Save as copy” as mentioned above or copy the code of the predefined template into the clipboard via the “Copy as code” option.


Inserting parameters into Jinja

If the value of the parameter is to be inserted into a Jinja statement, the double square brackets [[ ]] need to be wrapped with quotes " or '. This is because the parameter value is inserted into the file as text.

{% set paramValue = '[[ parameterName | defaultValue ]]' %}

If the parameter needs to be interpreted as other data type than string, the value may be converted with from_json filter.

{% set paramValue = '[[ parameterName | defaultValue ]]' | from_json %}