Hide or show content in email campaigns

Personalise your email content based on custom attributes

The display conditions feature allows you to make decisions on whether or not to show a row based on values stored in user profile attributes. This uses a conditional statement, which is one of the dynamic content options in Xtremepush.

Creating a display condition

Display conditions are associated with rows, and as such need to be created and edited from the row properties section of the email builder. This can be accessed by clicking on the row you want to edit, and from the display conditions section, clicking on Add condition.


A new window will appear where you can enter the display condition title and, optionally, a brief description.

Enter the conditional statement you want to apply to the row. For example, if you want to only show this row to VIP users (information that you would store in an attribute called VIP), you would need to use the following syntax:

// Before
{% if VIP == 'true' %}

// After
{% endif %}

This works because the email builder wraps the row that contains the content with the conditional statement.

You need to type the two parts of the conditional statement into the Before and After fields, as labelled in the code sample above. The complete configuration is shown in the screenshot below:



Whenever using a display condition it is important to bear in mind that users who don't have that attribute stored against their user profile will never be able to meet the conditional statement, and thus won't see the content.

Once you click on Confirm, the display conditions will be saved and you will be able to review them. Click on the expand button to review and edit the display condition, or click on the delete button to delete them from the row properties section.


Preview the email depending on the display conditions

In this example e-commerce newsletter, there is a row that includes a 10% discount that is only shown to VIP customers. This is easily seen because the row is wrapped by the conditional statements in the template preview:


The preview mode of the builder (click on Preview to open it) allows the marketer to easily preview the email depending on whether the display conditions are met or not.

To do so, click on Select row display conditions, then slide the toggle on or off for the desired display condition.

How email looks like for VIP users:


How will the email look like for the rest of users (VIP is not true or this attribute doesn't exist for the user):