Set up Dynamic Content with if-structures

If-structures are text-based constructions that allow you to introduce dynamic content. The if-structures take your personalisation to another level. You can use them to only display certain content to your contacts if they pass predefined criteria. Actually, you use the data from the database as a condition for deciding whether or not to allow certain bits of text or images to be seen. You set up these conditions by means of “if-then” statements. Depending on place of residence, for example, or on previous purchases, a contact gets to see offers that are relevant for him. If a contact fulfils the condition that you have defined in your if-structure, then the content will be displayed.

Follow this article to discover several detailed examples of if-structures and get inspired how to use them in your messages. 


Based on interest

MemberOf

With this structure, you can check whether a contact belongs to a particular interest group, and adapt the content of the email message to suit. 

Example: Based on his clicking behavior from previous campaigns, we know that John is interested in wine, but not in recipes and health. As a result, he has joined the group “Wine”. However, our newsletter contains articles on wine, recipes and health. How can we make sure that only the article on wine is included in John’s newsletter?

{if memberOf("Wine")}
       Article about wine
{/if}

If you think that a single click on a link is not a sufficiently convincing evidence for assuming that someone is interested in a particular topic, then you can expand this function by adding “the number of times” that your contact should have clicked on a link about that topic.

{if memberOf("Wine",3)}
St.-Emilion awarded a new rank. 
For the sixth time, a jury of nine sommeliers reviewed a wide selection of Bordeaux wines in the historic Sofitel Amsterdam The Grand hotel. In total, as already reported yesterday, 112 burgundy wines were selected from the 335 bottles submitted in the price range of €5 to €25. Most of the wines are red, but this year the selection also included dry and sweet white plus rosé wine. A booklet will soon be published on the 112 selected wines.
{/if}

In the example above, the contact was required to have clicked three times on an item about wines.


Based on preferences

hasPreference

With this structure, you can check whether a contact belongs to a particular preference (in this case food), and adapt the content of the email message to suit.

{if hasPreference("Food")}
       Article about food
{/if}


Based on the contact database

Content of a contact field

Another way to tailor the contents of your message to your contact is by checking the contents of a particular contact field.

{if ::language::=="FR"}
Des nouvelles locomotives pour améliorer la ponctualité
Neuf locomotives de « type 18 », construites par Siemens, ont obtenu une homologation provisoire. Après avoir réussi les tests techniques qui doivent confirmer l’homologation d’ici la fin août, l’opérateur SNCB effectue actuellement des tests en situation réelle, avec passagers, sur la ligne Eupen-Ostende.


{else}
St.-Emilion awarded a new rank.
For the sixth time, a jury of nine sommeliers reviewed a wide selection of Bordeaux wines in the historic Sofitel Amsterdam The Grand hotel. In total, as already reported yesterday, 112 burgundy wines were selected from the 335 bottles submitted in the price range of €5 to €25. Most of the wines are red, but this year the selection also included dry and sweet white plus rosé wine. A booklet will soon be published on the 112 selected wines.

{/if}

You can see in the previous example that the function {else} occurs. This allows you to specify an alternative if the contents of the contact field do not meet the condition.

Uppercase, lowercase, uppercaseFirst

Using the uppercase and lowercase functions, first the contents of the relevant contact fields are converted into uppercase or lowercase letters. If you don’t do this, your Dynamic Content is sensitive to upper case. You then run the risk that some contacts fall outside the condition because their language is noted in some other way.

{if uppercase(::language::)=="FR"}
Des nouvelles locomotives pour améliorer la ponctualité
Neuf locomotives de « type 18 », construites par Siemens, ont obtenu une homologation provisoire. Après avoir réussi les tests techniques qui doivent confirmer l’homologation d’ici la fin août, l’opérateur SNCB effectue actuellement des tests en situation réelle, avec passagers, sur la ligne Eupen-Ostende.

{/if}

{if lowercase(::language::)=="nl"}
St.-Emilion mag nieuw klassement
Voor de zesde keer heeft een jury van negen wijnproevers zich gebogen over een brede selectie van Bordeauxwijnen in het historische Sofitel Amsterdam The Grand hotel. In totaal zijn, zoals gisteren al gemeld, 112 bordeauxwijnen geselecteerd uit de 335 ingezonden flessen in de prijscategorie € 5 tot € 25 . De meeste geselecteerde wijnen zijn rood, maar dit jaar zat er ook weer droog en zoet wit plus rosé bij. Over de 112 geselecteerde wijnen verschijnt binnenkort een boekje.

{/if}

Fallback

Using the “Fallback” condition, you can provide an alternative in your message, whenever a contact field contains no value. By providing the example below, my contacts are always addressed by their first name. If their first name is not known, it will be replaced by “Dear Customer”.

Dear {fallback(::firstname::,"customer")}

Contains

In case you only want to check a part of a certain field, use the function "Contains".

{if contains(::firstname::,"Kevin")}
       …
{else}
       
{/if}

Length

When the length of a certain field can provoke a different content, then you should use the function "length". Let's say you want to sell personalised keychains but the keychain is too small to engrave more than 7 characters on it.  

{if length (::firstname::)<7}
       Article
{else}
       …
{/if}


There is more that you can do in Flexmail
Looking for some background information?
Did this answer your question? Thanks for your feedback There was a problem submitting your feedback. Please try again later.

Didn't find what you were looking for? Contact Us Contact Us