By configuring conditional content fields, you can create advanced personalization. Complete text blocks and/or images are replaced when a particular condition is satisfied.
In the example below, learn how to create a message, dynamically personalized on the recipient’s city and interests.
To create conditional content according to the value of a field, apply the following steps:
Open an existing delivery or create a new email delivery.
In the email content editor, click the personalization icon and select Conditional content > If.
The personalization elements are inserted in the message body. You must now configure them.
Fill in the parameters of the if expression.
<FIELD>
, and click the personalization icon to replace it with the test field.<VALUE>
with the value of the field for which the condition will be satisfied. This value must be in quotation marks.Click the Preview tab to view the content of the message according to the delivery recipient. Select a recipient for which the condition is true to check the content. Then select another recipient for which it is false and check again.
You can add other cases and define different content according to the values of one or more fields. To do this, use Conditional content > Else and Conditional content > Else if. These expressions are configured in the same way as the if expression.
The %> <% characters must be deleted after adding Else and Else if conditions.
In the example below, learn how to create a multilingual email. Content displays in one language or the other depending on the recipient’s preferred language.
Create an email and select the target population. In this example, the condition to display one version or the other will be based on the Language value of the recipient’s profile. These values are set to EN, FR, ES.
In the email HTML content, click the Source tab and paste the following code:
<% if (language == "EN" ) { %>
<DIV id=en-version>Hello <%= recipient.firstName %>,</DIV>
<DIV>Discover your new offers!</DIV>
<DIV><a href="https://www.adobe.com/products/en">www.adobe.com/products/en</A></FONT></DIV><%
} %>
<% if (language == "FR" ) { %>
<DIV id=fr-version>Bonjour <%= recipient.firstName %>,</DIV>
<DIV>Découvrez nos nouvelles offres !</DIV>
<DIV><a href="https://www.adobe.com/products/fr">www.adobe.com/products/fr</A></DIV><%
} %>
<% if (language == "ES" ) { %>
<DIV id=es-version><FONT face=Arial>
<DIV>Olà <%= recipient.firstName %>,</DIV>
<DIV>Descubra nuestros nuevas ofertas !</DIV>
<DIV><a href="https://www.adobe.com/products/es">www.adobe.com/products/es</A></DIV>
<% } %>
Test email content in the Preview tab by selecting recipients with different preferred languages.
As no alternative version has been defined in the email content, make sure to filter target population before sending the email.
Learn how to add conditional content to a delivery on the example of a multilingual newsletter.