Build conditional content add-conditions

Get started with conditional content gs

Conditional content is a powerful feature that allows you to create dynamic personalization based on the recipient’s profile, automatically replacing text blocks and images when certain conditions are met. This feature can take your campaigns to new heights and deliver highly targeted, personalized experiences to your audience.

By configuring conditional content fields, you can create advanced dynamic personalization based on the recipient’s profile for example. Text blocks, links, subject line, and/or images are replaced in the message content when a particular condition is satisfied. For example, you can display ‘Mr’ or ‘Mrs’ according to the value of the Gender field in Adobe Campaign database, or include a different link based on the recipient preferred language.

To create conditional content, you need to create conditions in the expression editor using specific helper functions. This method is available for all delivery channels, in any field where you can access the expression editor, such as the subject line, or email links and text/button content components. Learn how to access the expression editor

In addition to the expression editor, you can leverage a dedicated conditional content builder when designing an email that allows you to create multiple variants for an element of your email body. Learn how to create conditional content in emails

Create conditions in the expression editor condition-perso-editor

To define conditional content for a delivery using the expression editor, follow the steps below. In this example, we want to create conditional content based on the recipients’ language (French or English).

  1. Open a delivery and navigate to the content editing section.

  2. Locate the field where you want to add conditional content. For example, you can add conditional content to an SMS message.

  3. Click the Open personalization dialog icon next to the field to open the expression editor.

    img-md
    modal-image
  4. In the personalization editor, browse to the Helper functions menu on the left.

  5. To start building your condition, click the ‘+’ icon next to the If function. The following line is added to the central screen:<% if (<FIELD>==<VALUE>) { %>Insert content here<% } %>

    • Replace <FIELD> with a personalization field, such as the recipient’s language: recipient.language.

    • Replace <VALUE> with the value to satisfy. For example, 'French'.

    • Replace Ìnsert content here with the content that you want to display to the profiles that meet the specified condition.

      img-md
      modal-image
  6. Specify the content that should be displayed if the recipients do not meet the condition. To do this use an else helper function:

    1. Place your cursor before the expression closing tag %> and click the + next to the Else function.

    2. Replace Ìnsert content here with the content you want to display to the profiles that do not meet the if function’s condition.

    img-md
    modal-image

    You can also use the else if helper function to build conditions with multiple content variants. For example, the expression below displays three variants of a message depending on the recipients’ language:

    img-md
    modal-image
    note note
    NOTE
    Each time a helper function is added, opening (<%) and closing (%>) tags are automatically added before and after the function.
    Example after adding an “Else” helper function inside an expression: >
    <% if (<FIELD>==<VALUE>) { %>Insert content here<% } <% else { %> Insert content here<% } %>%>
    Make sure you remove these tags to avoid any syntax errors. In this example, the corrected expression after removing the else function tags is:
    <% if (<FIELD>==<VALUE>) { %>Insert content here<% } else { %> Insert content here<% } %>
  7. Once your condition is ready, you can save your content and check its rendering by simulating your content.

Create conditional content in emails condition-condition-builder

Conditional content in emails can be created in two ways:

  • In the expression editor by building a condition with helper functions,
  • In a dedicated conditional content builder that is accessible when designing an email.

The following section provides step-by-step instructions on how to create conditions using the email designer’s conditional content capability. Detailed information on how to create conditions using the expression editor is available here.

In this example, we want to create an email message with multiple variants based on the recipients’ language. Follow these steps:

  1. Create or open an email delivery, edit its content, and click the Edit email body button to open the email designing workspace.

  2. Select a content component and click the Enable conditional content icon.

    img-md
    modal-image
  3. The Conditional Content pane opens on the left-hand side of the screen. In this pane, you can create multiple variants of the selected content component using conditions.

  4. Configure your first variant. Hover over Variant - 1 in the Conditional Content pane and click the Add condition button.

    img-md
    modal-image
  5. A rule builder appears. It provides Profile, Message, and Delivery attributes that you can leverage to create your condition.

    In addition, the Conditions menu provides pre-built conditions that you can add to the canvas to easily build your variant. To use them, click the Add button then replace the elements between < and >symbols by the desired elements. Make sure that the value you specify for the <value> object is in quotation marks.

    img-md
    modal-image
  6. Once the condition for the first variant of the message is ready, click Confirm. In this example, we are creating a rule targeting recipients whose language is ‘French’.

    img-md
    modal-image
  7. The rule is now associated to the variant. For better readability, we recommend renaming the variant by clicking the ellipsis menu.

  8. Configure how the component should display if the rule is met when sending the message. In this example, we want to display the text in French if it is the recipient’s preferred language.

    img-md
    modal-image
  9. Add as many variants as needed for the content component. You can switch between the variants at any time to check how the content component will display based on their conditional rules.

    note note
    NOTE
    If none of the rules defined in the variants are met when sending the message, the content component will display the content defined in the Default variant from the Conditional Content pane.
recommendation-more-help
c39c2d00-ba9a-424b-adf9-66af58a0c34b