Dynamic Content takes personalization further by enabling conditional logic within an email. You can define rules based on tags, custom fields, location, or behavior so different subscribers see different text, images, or offers depending on their data.
Key Features:
- 
  Conditional content display using if/elif/else logic 
- 
  Tag-based content variations 
- 
  Custom field conditional logic 
- 
  Advanced operators and filters for complex rules 
Common Uses:
- 
  Tag-based offers: Show dog content to "dog" tagged subscribers, cat content to "cat" tagged subscribers 
- 
  Membership tiers: Display premium content only to VIP members 
- 
  Geographic targeting: Show region-specific events or offers 
- 
  Behavioral triggers: Different content based on purchase history 
Example:
Shows VIP content to subscriber who have a “premium” tag, standard content to everyone else.
{% if 'premium' in subscriber.tags %}
  Exclusive VIP content here
{% else %}
  Standard content here
{% endif %}
 
The variables below are small snippets of code that will pull specific subscriber and list information into your messages. For example, if you wanted to greet your subscribers and address them by their first names, then you would use "{{ subscriber.first_name }}" in the message. Similarly, if you wanted to add an additional unsubscribe link to your message, then you would use "{{ subscriber.unsubscribe_link }}."
You can also use these variables, as well as other codes like operators and comparison operators , to display specific content as long as certain conditions are met. There are a lot of different ways that you can use dynamic email content in your messages, but these variables are the building blocks to help you code dynamic email content.
 
  
  
 How to write dynamic email logic
In order to code for dynamic email content in your messages, you would have to include the logic tags below.
| {{ ... }} | Print the value of a subscriber variable |  | 
| {% ... %} | Evaluate an expression |  | 
| {# ... #} | Write comments in your message that are not seen by your subscribers. |  | 
| {% raw %} | Markup within the raw tag will not be evaluated as a variable or statement. |  | 
 
  
  
 Operators
Operators help you display specific content if certain conditions are met. If the first condition outlined by the "if" operator is not met, then the system will look to another condition based on the "elif" operator. If neither condition is met, then the system will look to the content with the "else" operator.
If you have multiple conditions, the system will display the content based on the "and" or "or" operator.
| if | Display message content IF the statement is true. |  | 
| elif | If the first condition isn't met, evaluate another condition. |  | 
| and | If both conditions are met, display message content. |  | 
| or | If one of the conditions is met, display message content. |  | 
| else | Display the following content to subscribers that did not meet any of the conditions above. |  | 
 
  
  
 Comparison Operators
Comparison operators work in conjunction with the operators above.
| == | equal to | 
| != | not equal to | 
| > | greater than | 
| >= | greater than or equal to | 
| < | less than | 
| <= | less than or equal to | 
 
  
  
 Filters
Filters help you customize the content by capitalizing specific letters, displaying fallback content when the subscriber doesn't have a value, and displaying a random option from a set of choices.
| upper() | Converts each character in a string to uppercase | HELLO THERE | 
| lower() | Converts each character in a string to lowercase | hello there | 
| capitali e() | Capitalizes the first word in a string | Hello there | 
| title() | Capitalizes each word in a string | Hello There | 
| default() | Provides a fallback if the variable has no value assigned | Dear friend, | 
| truncate() | Returns a truncated version of a string | The quick brown fox... | 
| wordwrap() | Wraps a string of text to a given width. | The string wraps when the next word doesn't fit on the line. In this example, the line width is set to only 20 characters in length. Chocolate bar soufflé dessert. Brownie tiramisu gummi bears donut donut tiramisu halvah sesame snaps tart. Cheesecake fruitcake chupa chups ice cream. | 
| replace() | Return a copy of a string with all the occurances of a substring replaced with a new one. | The quick brown rabbit jumps over the lazy dog | 
| first() | Returns the first item of a sequence | Apples | 
| last() | Returns the last item of a sequence | Grapes | 
| unique() | Returns a unique set of items in a sequence | red blue yellow orange white | 
| count() | Returns the number of items in a list | 6 | 
| sum() | Returns the sum of a sequence | 3418 | 
| min() | Returns the smallest item in a list | 1 | 
| max() | Returns the largest item in a list | 975 | 
| random() | Select a random item from a set of choices | Grapes | 
| join() | Returns a string of items joined by a separator. | Apples | Oranges | Grapes | 
| select() 
 | Filter a sequence to items matching the criteria provided. | 1 3 5 7 Other examples include:  | 
| random_number() | Returns a random number between two values. | 371 | 
| round() | Round a number to a given number of decimal places | 34.24 | 
| now() | Returns the current date and time. | 01/26/2021 | 
| hash_md5 | Returns an MD5 hashed value | d25d937d5ba2b799ad482aabca11c660 | 
 
  
  
 Date Formatting Options
| 
 | Token | Example and Output | 
| Year | YYYY | The current year is 2021 | 
| 
 | YY | The current year is '21 | 
| Month | MMMM | The month is April | 
| 
 | MMM | The month is Apr | 
| 
 | MM | The month is 04 | 
| 
 | M | The month is 4 | 
| Day of the Year | DDDD | Today is day number 095 | 
| 
 | DDD | Today is day number 95 | 
| Day of the Month | DD | Day 05 of the month. | 
| 
 | D | Day 5 of the month. | 
| 
 | Do | 5th day of the month. | 
| Day of Week | dddd | Today is Monday. | 
| 
 | ddd | Today is Mon. | 
| 
 | d | Today is day 1 of the week. | 
| Hour | HH | The hour is: 04. Possible values: 00, 01, 02 ... 23, 24 | 
| 
 | H | The hour is: 4. Possible values: 0, 1, 2 ... 23, 24 | 
| 
 | hh | The hour is 04 Possible values: 01, 02, 03 ... 11, 12 | 
| 
 | h | Possible values: 1, 2, 3 ... 11, 12 | 
| AM / PM | A | We will begin at 2 PM. | 
| 
 | a | We will begin at 2 pm. | 
| Minute | mm | Possible values: 00, 01, 02 ... 58, 59 | 
| 
 | m | Possible values: 0, 1, 2 ... 58, 59 | 
| Second | ss | Possible values: 00, 01, 02 ... 58, 59 | 
| 
 | s | Possible values: 0, 1, 2 ... 58, 59 | 
| Date Shift | Shift the date into the future or the past. | The above example will print the date for "10 days ago". | 
 
  
  
 Subscriber Information
| Field Name | Variable | Displays | 
|---|---|---|
| Full name | 
           | The subscriber's first and last name if both are available. | 
| First name |  | Only the subscriber's first name, before the first space. For example: if the subscriber's name is "John Joseph Smith," it would only pull "John." | 
| Last name |  | Only the subscriber's last name. | 
| Email address |  | The subscriber's email address. | 
| Identifiers (int) |  | A unique subscriber identifier (int) | 
| Identifiers (UUID) |  | A unique subscriber identifier (UUID) | 
| Tags |  | Content tailored to subscribers that are labeled with various tags. | 
| Custom fields |  | Content tailored to a specific custom field. Replace 'FIELD_NAME' with the custom field name you created. | 
| Unsubscribe link |  | An additional unsubscribe link. | 
 
  
  
 Example
Using an if statement with custom fields, you can display content based on a specific custom field. In the example image below, a picture of a dog will display if in the email the receiving subscriber’s custom field “favorite_pet” is “dog”:
Unknown Attachment
 
  
  
 Greeting a subscriber without a name
If not all of your subscribers provided a name when they signed up for your newsletter, you can still safely attempt a personalized greeting.
Unknown Attachment
Hello {{ subscriber.first_name or "friend" }},
Using the code above, the greeting will default to the word "friend" if the subscriber did not sign up with their name. Depending on the subscriber, the result will look similar to one of the following:
- 
  Hello Jessica, 
- 
  Hello friend, 
You can avoid dangly commas when a name is missing and you don't want to use "friend" or another variation by using this format:
{% if subscriber.first_name %}
{{ subscriber.first_name }}, hello today!
{% else %}
Hello today!
{% endif %}
 
  
  
 Capitalizing subscriber names
You don't want to make the mistake of greeting your subscribers with their names in all caps, like "Hello JESSICA," or even all lowercased, like "Hello jessica." These capitalization mistakes look sloppy and impersonal or computer-generated. When subscribers fill out your sign up form, they may not have properly capitalized their names, but you can handle this when you greet them in your email messages.
Hello {{ subscriber.first_name | capitalize() }},
If you want to ensure proper capitalization and provide a fallback for missing names, you can use the following example:
{% if subscriber.first_name %} 
{{ subscriber.first_name }}, hello today!
{% else %}
Hello today!
{% endif %}
 
  
  
 Subscriber Sign Up Details
| Field Name | Variable | Displays | 
|---|---|---|
| Date |  | The date that a subscriber was added. | 
| Sign up URL |  | The URL where the subscriber signed up for your list. Note: most API integrations will not pass the URL to AWeber. | 
| Unsubscribe URL |  | An additional unsubscribe link. | 
| City |  | The city based on the IP address where the subscriber signed up. | 
| Postal code |  | The postal code based on the IP address where the subscriber signed up. | 
| Country |  | A way to tailor messages to subscribers in specific countries. | 
| Region |  | A way to tailor messages to a specific region, like a province. | 
| DMA |  | The subscriber's Direct Marketing Association code. | 
| Longitude |  | The subscriber's longitude. | 
| Latitude |  | The subscriber's latitude. | 
 
  
  
 Message Details
| Field Name | Variable | Displays | 
|---|---|---|
| Broadcast Archive URL |  | Your broadcast archive URL. | 
| Message ID |  | An integer message ID rendered after a broadcast is sent. | 
 
  
  
 List Details
| Field Name | Variable | Displays | 
|---|---|---|
| Global Fields |  | Any of your global text snippets in your list settings. Replace 'FIELD_NAME' with the name of your snippet. | 
| Signature |  | Your email signature. | 
| Company Name |  | Your company name. | 
| List Contact Address |  | Your CAN-SPAM mailing address. | 
| Identifier (int) |  | A unique List identifier (int). | 
| Identifier (UUID) |  | A unique List identifier (UUID). | 
| Ignore |  | Allows you to use double curly braces without triggering dynamic content rendering. Useful when outputting code. | 
