Every email you send from Loops can contain dynamic content connected to the contact you’re sending to or the event that triggered the email.

Types of dynamic content

The three email types in Loops have different dynamic content available to them:

  • Campaign emails can contain contact properties.
  • Emails within Loops can contain contact properties and event properties.
  • Transactional emails can contain data variables.

The three types of dynamic content are:

  • Contact properties are pieces of data related to each contact in your audience. There are a set of default properties like name and source, but you can also add any number of custom contact properties. If you sync contact data to Loops with the API, an integration or with CSV uploads, you can include that data in your email.
  • Event properties are pieces of data that can be sent along with every event (which are used to trigger loop emails) via integrations or API calls.
  • Data variables are pieces of data included in transactional emails, which are populated in the API call.

Add dynamic content to emails

If you want to add dynamic content to a custom MJML email, check the Dynamic tag syntax section below.

To add dynamic content to emails, simply select the corresponding icon in the toolbar of the email editor.

You can also add dynamic content in all of the sending setting fields. An icon appears on the right when you hover over each field.

Depending on whether you’re editing a campaign, loop or transactional email, you will have different options (explained above).

When the email is sent, the dynamic content will be replaced with actual values from the contact, event or data variable.

If you send an email and the dynamic content is missing a value, the email will not be sent. Make sure to add fallback values to avoid missed sends.

A common example of using dynamic content is to personalize an email greeting by using a contact’s first name.

Once you’ve clicked on the icon in the toolbar, select the contact property you want to add. In this case, First Name.

When the email is sent, the contact’s data will be added to your email, like this: Hey Chris, (if the contact doesn’t have a First name value, it will read Hey there,).

Custom properties

Any contact attributes you sync with Loops either through the API or through one of our integrations can be added to an email to personalize it.

Likewise, any data variables you add to your transactional emails, or event properties you add to your events, will also appear as options in the editor.

For example, say you wanted to create a Scheduled digest email with metrics about a contact over the last week. You could sync those metrics to Loops as event properties.

These properties will automatically be available to insert into any emails triggered by that event.

Fallback values

It is important to set a fallback variable for any dynamic content you add to your campaign and loop emails.

If a contact does not have a value for the related contact property, or you don’t remember to include an event property for an event-triggered email, the email will fail to send.

Fallback values can be used to make sure default content is added to the email and ensure that it is sent.

For example, if you set a fallback variable for “First Name” as “there”, if a contact does not have this contact property, the email will include “there” in the place of the contact’s name.

This is a great way to make sure that your emails still feel personalized to contacts even if there is no property available.

Dynamic tag syntax

As well as adding dynamic content using the toolbar icons, you write “tags” directly in the email body. This is especially useful when uploading custom emails.

These tags are the only way to add dynamic content in custom MJML emails.

Contact properties

If you have a custom contact property named teamName that you want to add to a campaign, you can write it surrounded by curly brackets in the email:

{teamName}

When the email is sent, the teamName value for each contact will be added to the email.

For a list of all of your contact properties, visit the API Settings page. The API Name is the name you use within the brackets in your email, for example {firstName}, {lastName}, {email}, etc.

Event properties

To add dynamic data to emails within loops using event properties, the tag requires an EVENT_PROPERTY: prefix:

{EVENT_PROPERTY:firstName}

Data variables

To add data variables in transactional emails, the tag requires a DATA_VARIABLE: prefix:

{DATA_VARIABLE:firstName}

It’s important to use camelCase format to type your tags. If you have any questions about how to format your tags, reach out to us!