In this post we will be going over how to pass dynamic content with the Mandrill connector.
One way to add dynamic content to your Mandrill templates is by using part of the MailChimp template language in your templates to create regions that can be completely replaced with customized content when sending an email.
Mandrill supports one specific element of the MailChimp template language: editable content areas (also known as mc:edit regions). You can use these within your desired template to create regions that can be completely replaced with customized content when sending an email. AudienceStream will populate these areas dynamically.
Within Mandrill, you may also use Merge tags to personalize your messages with your recipients’ names, addresses, order information, or other customized content.
We will create and assign our editable regions and merge variables within the template.
For this example, we will create a "header" , "main", and "footer" section. To add an editable region to your HTML, you'll add the following within an HTML tag:
It is important when creating your editable regions that each one has a unique identifier.
Next, we will need to define our merge variables to create an element of personalization to our emails. We will need to make variables for our first name, response email, and a special one to show based on certain conditions.
It is important to note that merge tags use the following format, with a pipe (
|) and asterisk (<code>*) on each side of the merge tag name:
Mandrill conditional merge tags support traditional IF, ELSE, ELSEIF, IFNOT logic, and the following operators:
Next, we must set up and configure our connector in AudienceStream. If you are unfamiliar with the process, please see the post below.
In AudienceStream, navigate to the "Actions" tab of your Mandrill Connector. It is in this window that we select our desired template and map our editable areas and merge variables.
For this example, we will set our merge variables ("FNAME", "MERGE", "SUPPORT_TEAM_EMAIL") and editable areas to custom values to better illustrate what is happening. For a live use case though, these variables would be mapped to various AudienceStream attributes like traits and visitor ID's.
Next, we will need to save and publish our changes.
After we have defined the dynamic areas of the template and configured our actions, we will need to ensure that we are getting the proper email results.
This validation essentially has two parts:
In the image above we can see that our merge variables were properly set with the values we put in our custom fields, and the header content was successfully replaced.
Mandrill offers a flexible platform to meet the many needs their users require. Through the use of merge variables and editable content areas, we can manipulate our templates to satisfy our most challenging transactional email use cases.