Member Login

How to use dynamic content

What is dynamic content?

Dynamic content makes it possible to use audience members' information to determine the content that is delivered to their inboxes. It's similar to personalization, but you can use it for whole sections of text, one or more content blocks, or even an entire mailing worth of content. It's powerful but requires some knowledge of tag syntax. 

When you're using dynamic content, you're testing an audience member to see if the contents of their member fields meet certain criteria. If they meet the criteria, Frankie will insert the content. If they don't meet the criteria, Frankie will either move on to the next test, insert a default, or do nothing.

Required tags

To use dynamic content you must use at least two tags: the if tag, and the end if tag. 

Tag Example Purpose Required? Max/set?
if [% if member:city == "Nashville" %]

- Start dynamic content

- Test recipient contact information (member:city) against a value ("Nashville")

Yes 1
end if [% endif %]

End dynamic content

Yes 1

 

If you were to use only these two tags, your dynamic content would still work perfectly. It would test the recipient's contact information against the value in the if tag and send the content if the recipient passes the test, or move on to the next tag if the recipient doesn't pass the test. Since the next tag is the end if tag, the dynamic content will close. 

Simply put, if you only use the if and end if tags, you will send the content between the tags to people who pass the test, and you will exclude the content between the tags to people who do not pass the test. 

Optional tags

There are two optional tags: elif and else. 

Tag Example Purpose Required? Max/set?
elif [% elif member:city == "Portland" %]

Test recipient contact information (member:city) against a value ("Nashville") after having failed the previous test

No No max (you can use as many as you want)
else [% else %]

Default content for any recipient that has failed all of the previous if and elif tags.

No 1

 

These two tags will allow you to add secondary tests and a default. If you include an elif tag, you can send content to people who have failed the opening if test but will pass the elif test. You can add as many of these as you'd like. 

If you include an else tag, you can send default content to members that have not passed the if test or any of the elif tests. The else tag doesn't test a field against a values, it just provides a fallback. It's like adding a placeholder in a personalization tag. Additionally, the else values will display on your webview, so if you plan on posting to social media, make sure you're using one of these. 

Operators

Below are descriptions of the operators you'll use for dynamic content. 

Element Description Code sample

if

if indicates the beginning of a conditional statement or beginning of a series of conditional statements. Each statement must have its own if and endif tags (those two are required and must start and finish the statement, respectively).

[% if member:city == "Nashville" %]

elif

elif is shorthand for "else if." In a series of conditional statements, all statements after the initial "if" statement begin with elif. If an "if" statement is not true, the subsequent elif statements are evaluated next. You can have as many elif tags as you want as long as they follow the if tag and precede the else tag.

[% if member:city == "Nashville" %]
     You live in Nashville!
[% elif member:city == "Portland" %]
     You don't live in Nashville, you must live in Portland!
[% endif %]

else

else defines a default state for your conditional statements. If none of your statements are true, this content will render in its place. else is also very important because this content will render in the webview and PDF version of your mailing containing dynamic content. there can only be one else tag in each statement.

[% if member:city == "Nashville" %]
     You live in Nashville!
[% elif member:city == "Portland" %]
     You don't live in Nashville, you must live in Portland!
[% else %]
     We don't know where you live, but we're sure it's awesome!
[% endif %]

endif

endif indicates the end of all conditional statements. Make sure to always use it at the close of your dynamic content. 

[% if member:city == "Nashville" %]
     You live in Nashville!
[% elif member:city == "Portland" %]
     You don't live in Nashville, you must live in Portland!
[% else %]
     We don't know where you live, but we're sure it's awesome!
[% endif %]

==

== is a symbol for "is equal to." For example, if a member's city is equal to Nashville, display the indicated content.

[% if member:city == "Nashville" %]
     You live in Nashville!
[% endif %]

!=

!= is a symbol for "is not equal to." For example, if a member's city is not equal to Nashville, display the indicated content.

[% if member:city != "Nashville" %]
     You don't live in Nashville!
[% endif %]

>

> is a symbol for "is greater than." For example, if a member's age is greater than 12, display the indicated content. This operator only works with numeric fields and does not work with the default Postal Code field. 

[% if member:age > "12" %]
     You are older than 12.
[% endif %]

<

< is a symbol for "is less than." For example, if a member's age is less than 12, display the indicated content. This operator only works with numeric fields and does not work with the default Postal Code field. 

[% if member:age < "12" %]
     You are younger than 12.
[% endif %]

and

and allows you to be very specific about the recipient you are targeting. For example, you may want to target a recipient who lives in Nashville and is female.

[% if member:city == "Nashville" and member:gender == "Female" %]
     You live in Nashville and are female.
[% endif %]

or

or allows you to be broader in your statements. For example, you may want to target recipients who live in Nashville and are female or male.

"and" and "or" can be tricky because you have to pay attention to the order in which they're evaluated. You may need to put a statement or two in parentheses. Think back to basic math class: If member city is Nashville and (member gender is female or member gender is male)

The male/female statement will evaluate separately.

[% if member:city == "Nashville" and (member:gender == "Female" or member:gender == "Male")  %]
     You live in Nashville and are either female or male.
[% endif %]


How does this look in my mailing?

You can insert dynamic content all in one block or in multiple blocks. Here's how your mailing will look in the drag & drop editor:

Those who should receive the Drums version will see this in their inbox, once you've added the rest of your dynamic content:

And here's the Guitar version:

 

Dynamic content, step by step

Although dynamic content technically does involve code, it’s easy for even the non-technical marketer to use in the drag & drop editor.

  1. Drag an HTML block into your mailing where you want the dynamic section to start, clear out the text and insert this code to open your dynamic content section: [% if member:fieldgoeshere == "criteriagoeshere" %] (see tag library below for more), in which you specify the first criteria you want to target. Be sure to use the shortcut name for your fields, not the display name. You can view the difference on your Audience page by clicking Manage contact fields and then choosing the Edit option from the downward pointing arrow beside the field you need:
  2. sert your variable content by dragging in the content blocks (any content type, including text, video, and images) you want the criteria to see.
  3. To create a variation on that content for a different set of recipients, drag in another HTML block and insert the code that signifies you're on to the next variation.
  4. Drag in the content blocks you want that set of recipients to see.
  5. Repeat steps three and four for any other variations and for your default version.
  6. Drag in a final HTML block, and insert the code that closes the dynamic section of your email: [% endif %]
  7. Set up test contacts that fit the criteria of each set of recipients, send a test and see how one email can be personalized to fit each of your contacts.

Tips

  • Check your contact fields to make sure they're spelled right and case-sensitive. For example, [% if member:favorite-color == "Red" %] will only work for people with "Red," capital R, in the favorite-color field. [% elif member:favorite-color == "red" %] will only work for people with "red," lowercase r, in the favorite-color field.

  • Use and/or logic to include multiple groups in a tag. Use greater than/less than/do not include logic to further personalize your mailing.

  • It's possible to nest if statements if each statement or series of conditional statements has its own [% endif %].

  • Dynamic content needs to be clearly defined with one answer in order to work. Because of this, it's important to only choose options from the dropdown list that allows for one selection to be chosen. The checkbox or multiple-choice options will not work for dynamic content because they allow the field to contain multiple answers.

  • Create a test group where one contact fits each segment, and send a test first before sending it to your audience.

  • There are three sections in your mailing where content blocks can be placed (top row, columns, bottom row). Dynamic content only works if contained within one of those sections in your mailing. If you start your dynamic content in "top row", it will break if it continues into "columns" or "bottom row". 

Common use cases

If you want males and females to see different content:
The tag to open the section with female-specific content will look like this:
[% if member:gender == "female" %]   Content for females goes here.
And the tag to open the section with male-specific content will look like this:
[% if member:gender == "male" %]   Content for males goes here.
 
Don’t forget to add a default section for those whose gender information you do not have, and close out the section with an [% endif %] tag.
 
If you want to specify a segment that has multiple criteria:
To show a section of content to people named Kevin in Tennessee:
[% if member:first_name == "Kevin" and member:state == "TN" %]  
 
Remember that when you add a variation, use elif instead of ifIf is just for the opening tag.
 
If you want to include both "and" logic AND "or" logic:
To show a section of content to people named Martha in Tennessee or Michigan:
[% if member:first_name=="Martha" and (member:state=="TN" or member:state=="Texas") %]
 
If you want to exclude a particular group:
To make sure everyone except those who live in New York sees a section of content:
[% if member:city != "New York" %]
 
Note the ! that replaces the first =. This means does not equal.  
 
If you want to specify a "greater than" or "less than" segment:
To show a section of content to contacts that are over 21 years of age:
[% if member:age > "21" %]  
 
If you want to see what the whole string looks like:
To show one section of content to people who live in Boston and a different section to people who live in Charleston, and if you want to have a default section, here's how your entire string would look:

[% if member:city == "Boston" %]
Insert image and HTML block for Boston residents
[% elif member:city == "Charleston" %]
Insert image and HTML block for Charleston residents
[% else %]
Insert generic image and HTML block
[% endif %]

If you want Dynamic Content to be displayed if a field is empty or not empty.
Yes, you can have Dynamic Content sections defined like this:
[% if member:state == "" %]
This will show content only to folks for whom the field is empty.
OR
[% if member:state != "" %]
This will show content only to folks for whom the field is not empty, or with anything in the field.