Use Advanced Dynamic Variables

Article author
Sarah Malone
Updated

Overview

Dynamic variables enable you to personalize emails for individual contacts by leveraging Apollo's data and, in the case of custom dynamic variables, your own data research. Advanced dynamic variables are somewhat different from basic dynamic variables in that they allow for limited conditional logic.

This means advanced dynamic variables can provide a fallback if there's no data for a specific field for a contact. You can use conditional logic in AI power-up prompts or in emails with variables to help them send successfully.

Conditional Logic

Check out the following sections to learn more about advanced dynamic variables.

Back to Top

Types of Advanced Dynamic Variables

Advanced dynamic variables come in several different types:

Each of these advanced dynamic variable types enables you to further personalize email templates for your customers.

Back to Top

Empty Fallback

Use the empty fallback advanced dynamic variable to send emails without fearing they won't send because a basic dynamic variable lacks data. With an empty fallback, your email sends with a blank space in place of the variable if Apollo doesn't have data for a contact.

Imagine you want to send an email that greets each recipient by their first name. You could use the {{first_name}} basic dynamic variable to say:

Greetings {{first_name}},

However, if Apollo doesn't have a first name for a contact in your sequence, the dynamic variable fails and Apollo moves your email to the Not Sent folder.

To avoid this situation, use the advanced dynamic variable {{#if first_name}}{{#endif}} to create a generic fallback:

Greetings {{#if first_name}}{{#endif}},

If Apollo has the data for an email recipient, the dynamic variable renders in the email:

Greetings John,

If Apollo doesn't have the data, the email still sends with an empty space in place of the dynamic variable:

Greetings ,

Back to Top

Dynamic Fallback

Advanced dynamic variables with a dynamic fallback go a step further than the empty fallback variety. These dynamic variables insert text that you define in the event that there is no relevant data for a contact.

Imagine you want to use generic text if a recipient's first name is unavailable. To do that, use the following advanced dynamic variable to create a dynamic fallback:

Hi {{#if first_name}}{{first_name}}{{#else}}there{{#endif}},

If Apollo has the data for an email recipient, the first name renders in the email:

Hi John,

If Apollo doesn't have the necessary data, the email renders with there in place of the variable:

Hi there,

It's important to understand what each part of the dynamic variable does. The first part, {{#if first_name}}{{first_name}}, is the start of the conditional logic. It tells Apollo "If there is a value for first name, render that first_name value in the opened email". This is similar to the basic dynamic variable {{first_name}}, with the inclusion of an {{#if}} statement.

The next part,{{#else}}there, tells Apollo "If no first name value is available for this contact, use the text there instead".

The final part, {{#endif}}, tells Apollo that this is the end of the conditional logic for this dynamic variable.

Back to Top

Letter Case and Pluralization Operators

Advanced dynamic variables with letter case and pluralization operators take the value of a field and change the case or the pluralization.

 
String Fields Only

These advanced dynamic variable types only work on string field types. They don't work for other field types.

The following examples show how letter case and pluralization operators can be used:

Dynamic Variables Description Example
{{title->lowercase}} Takes the value of a contact's job title and converts every letter in it to lowercase. Engineering Manager becomes engineering manager
{{title->capitalize_each_word}} Takes the value of a contact's job title and converts the first letter in every word to uppercase. engineering manager becomes Engineering Manager
{{title->plural}} Takes the value of a contact's job title and converts it to the plural form. Engineering Manager becomes Engineering Managers

Add a -> within the variable to combine multiple case and pluralization operators. For example, to convert a contact's job title to uppercase and plural form, combine the operators within the same variable:

{{title->capitalize_each_word->plural}}

This dynamic variable renders the job title engineering manager as Engineering Managers.

Back to Top

Now-Date/Time Operators

Advanced dynamic variables with {{now_month}}, {{now_day}}, and {{now_time}} operators take the current date and manipulate it in various ways.

 
Date-Type Fields Only

These advanced dynamic variable types only work on date field types. They don't work for other field types.

The following examples show how now-date and time operators can be used:

Dynamic Variables Description Example
{{now_day->plus_X}} Takes the current day and moves it forward by the specified number of business days. If the number of business days exceeds the number of days in the current month, Apollo accounts for the transition and continues the count at the first day of the upcoming month. You can use any whole number (integer) here. If today is the 15th day of the month and a Wednesday, the dynamic variable {{now_day->plus_5}} renders as 22 in the opened email.
{{now_day->minus_X}} Takes the current day and moves it backward by the specified number of business days. If the number of business days exceeds the number of days in the current month, Apollo accounts for the transition and continues the count at the last day of the previous month. You can use any whole number (integer) here. If today is the 15th day of the month and a Wednesday, the dynamic variable {{now_day->minus_5}} renders as 8 in the opened email.
{{now_month->plus_X}} Takes the current month and moves it forward by the specified number of months. You can use any whole number (integer) between 1 and 11. If the current month is April, the dynamic variable {{now_month->plus_1}} renders as May in the opened email.
{{now_month->minus_X}} Takes the current month and moves it backward by the specified number of months. You can use any whole number (integer) between 1 and 11. If the current month is April, the dynamic variable {{now_month->minus_2}} renders as February in the opened email.
{{now_year->plus_X}} Takes the current year and moves it forward by the specified number of years. You can use any whole number (integer) here. If the current year is 2024, the dynamic variable {{now_year->plus_2}} will render as 2026 in the opened email.
{{now_year->minus_X}} Takes the current year and moves it backward by the specified number of years. You can use any whole number (integer) here. If the current year is 2024, the dynamic variable {{now_year->minus_1}} will render as 2023 in the opened email.
{{now_time_of_day}} Displays the current time stage of the day (morning, afternoon, evening). If the current time is 9:00am, the dynamic variable Good {{now_time_of_day}}, renders as Good morning, in the opened email.

Back to Top

Custom Date Operators

 
Select Plans Only

Custom fields and dynamic variables that leverage custom date operators are only available for customers on certain Apollo plans. If you don't have access and would like to upgrade your plan, reach out to the Apollo sales team.

Advanced dynamic variables with custom date operators make use of custom fields configured for dates and manipulate them in various ways.

 
Date-Type Fields Only

These advanced dynamic variable types only work on date-type field types. They don't work for other type fields.

Imagine you create a custom field called product_announcement for the date of your yearly product announcement that takes place on October 15, 2024. That custom field includes a month, day, and year, so you can use custom date operators in a dynamic variable to extract specific pieces.

The dynamic variable {{product_announcement->day}} renders as 15, the dynamic variable {{product_announcement->month}} renders as October, and the dynamic variable {{product_announcement->year}} renders as 2024 in the opened email.

In addition, you could use the dynamic variable {{product_announcement->weekday}} to extract the day of the week for your custom date. In this instance, it renders as Tuesday in the opened email because October 15, 2024 is a Tuesday.

Back to Top

Example Use Case For Advanced Dynamic Variables

 
Formatting For Clarity Only

In this example, the text is formatted to offset the dynamic variables from the plain-text copy, and line breaks are inserted between each conditional logic statement for ease of reading. You should write dynamic variables in Apollo as a single, continuous line.

For additional context, take a look at a real-world example of how to use advanced dynamic variables in your email template. Within an automatic email task, we created an email template with body copy that leverages several different advanced dynamic variable types.

Hi {{#if first_name}}{{first_name}}{{#else}}there{{#endif}},

We know many companies like

{{#if industry == Marketing}}Company 1
{{#else}}{{#if industry == Big Data}}Company 2
{{#else}}Company 3{{#endif}}{{#endif}}

are looking for new tools to implement for {{now_year->plus_1}}, and we'd like to walk you through our platform so that you have a good understanding of our full capabilities. Does {{now_weekday->plus_2}} or {{now_weekday->plus_3}} {{now_time_of_day}} work for you?

View the use of advanced dynamic variables.

Use Case Explanation: Nested Dynamic Variables Pointing to Specific Field Values

The {{#if first_name}}{{first_name}}{{#else}}there{{#endif}} dynamic variable sets up a fallback for the first name to render as there if there is no first name data available for the email recipient.

The {{#if industry == Marketing}}Company 1 portion of the dynamic variable tells Apollo to render the text as Company 1 if the Industry field for the email recipient is Marketing. If the industry is not Marketing, Apollo moves on to the next piece of conditional logic.

The {{#else}}{{#if industry == Big Data}}Company 2 portion tells Apollo to render the text as Company 2 if the Industry field for the email recipient is Big Data. If the Industry is not Marketing or Big Data, Apollo moves on to the fallback portion of the conditional logic.

The dynamic variable {{#else}}Company 3 is the fallback if the email recipient's Industry field does not match Marketing or Big Data. In this instance, the text renders as Company 3 in the opened email.

The final portion of the dynamic variable, {{#endif}}{{#endif}}, closes the conditional logic. Two {{endif}} statements are required because there are nested {{#if}} statements.

 
How many {{endif}} statements do I need?

As a general rule, for each {{#if}} statement in your dynamic variable, you need a corresponding {{#endif}} to close the dynamic variable.

Use Case Explanation: Now-Time Dynamic Variables

The dynamic variable {{now_year->plus_1}} tells Apollo to take the current year 2024 and add 1 year to it. When the recipient opens this email, this variable renders as 2025.

The dynamic variable {{now_weekday->plus_2}} tells Apollo to take the current day of the week and advance it by 2 days. If Apollo sends the email on a Monday, the text in the email renders as Wednesday. If Apollo sends this email on a Thursday, the text will render the dynamic variable as Monday because it is the next available weekday.

The {{now_weekday->plus_3}} dynamic variable tells Apollo to take the current day of the week and advance it by 3 days. If Apollo sends the email on a Tuesday, the text in the email will render as Friday. If Apollo sends the email on a Wednesday, the text renders as Monday. Apollo renders the dynamic variable as the next available business day if the day of the week specified by the dynamic variable falls on a weekend day.

Finally, the {{now_time_of_day}} dynamic variable tells Apollo to display the current time stage of the day for the recipient based on their local time in their local timezone (when it is available) and renders morning, afternoon, or evening.

Back to Top