Overview
Advanced dynamic variables are somewhat different from basic dynamic variables in that they allow for limited conditional logic.
That means advanced dynamic variables can provide a fallback in the event that there is no data for a specific field for a contact. This allows you to avoid having emails shipped to the Not Sent folder when you try to reach a contact with a dynamic variable for which Apollo has no data.
Refer to the sections below for how to use all of the different types of advanced dynamic variables supported in Apollo email templates.
Types of Advanced Dynamic Variables
Advanced dynamic variables come in several different flavors:
- Empty Fallback
- Dynamic Fallback
- Letter Case and Pluralization Operators
- Now-date/time Operators
- Custom Date Operators
Each of these advanced dynamic variable types allows you to further personalize email templates for your customers.
Advanced Dynamic Variables With an Empty Fallback
The first type of advanced dynamic variable allows you to send templated emails to recipients without the fear of having them end up in the Not Sent folder when a basic dynamic variable does not render because of a lack of available data. In short, advanced dynamic variables with an empty fallback do not print any personalized text if it is not available in the Apollo database.
Imagine that you want to send an email that greets each recipient by their first name. To accomplish that, you might decide to use the {{first_name}}
dynamic variable to say something like:
Greetings {{first_name}},
If one of the contacts in your sequence does not have a first name in the Apollo database, the dynamic variable fails and Apollo moves your email to the Not Sent folder.
To avoid this, you could use the advanced dynamic variable {{#if first_name}}{{#endif}}
to create a generic fallback:
"Greetings {{#if first_name}}{{#endif}},
For recipients with first name data in the Apollo database, the dynamic variable renders in the email like this:
Greetings John,
Recipients without first name data in the Apollo database receive an email that renders like this:
Greetings ,
Advanced Dynamic Variables With a Dynamic Fallback
Advanced dynamic variables with a dynamic fallback go one step further than the empty fallback variety. These dynamic variables print text that you define in the event that there is no data for a particular field when a recipient opens a sequence email.
Continuing with the scenario above, imagine that you want to use generic text in place of a recipient's first name if it is not available. If we use the following dynamic variable:
Hi {{#if first_name}}{{first_name}}{{#else}}there{{#endif}},
The email renders like the example below if no first name data is available on open:
Hi there,
If the recipient does have first name data available, the email will still render like this:
Hi John,
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 what the basic dynamic variable {{first_name}}
does with the exception of 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.
Advanced Dynamic Variables With 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.
Please note, these Advanced dynamic variable types only work on string
type fields. They will not work for other field types.
Examples
Dynamic Variables | Description | Example |
---|---|---|
{{title->lowercase}} |
Takes the value of a contact's 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 title and converts the first letter in every word to lowercase | engineering manager becomes Engineering Manager |
{{title->plural}} |
Takes the contact's title and converts it to the plural form | Engineering Manager becomes Engineering Managers |
You can combine multiple case and pluralization operators in a single advanced dynamic variable:
{{title->capitalize_each_word->plural}}
In the opened email, this dynamic variable renders the title engineering manager
as Engineering Managers
.
Advanced Dynamic Variables With 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.
Please note, these Advanced dynamic variable types only work on date
field types. They will not work for other field types.
Examples
Dynamic Variables | Description | Example |
---|---|---|
{{now_day->plus_X}} |
Takes the current day and moves it forward by the specified number of days. You can use any whole number (integer ) here. |
If it is currently the 15th day of the month, an email that includes the dynamic variable {{now_day->plus_10}} will render as 25 in the opened email. |
{{now_day->minus_X}} |
Takes the current day and moves it backward by the specified number of days. You can use any whole number (integer ) here. |
If it is currently the 10th day of the month, an email that includes the dynamic variable {{now_day->minus_5}} will render as 5 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 here. |
If the current month is September, an email that includes the dynamic variable {{now_month->plus_1}} will render as October 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 here. |
If the current month is September, an email that includes the dynamic variable {{now_month->minus_2}} will render as July 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 2021, an email that includes the dynamic variable {{now_year->plus_2}} will render as 2023 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 2021, an email that includes the dynamic variable {{now_year->minus_5}} will render as 2016 in the opened email |
{{now_time_of_day}} |
Displays the current stage of the day (morning , afternoon , evening ) |
Adding Good {{now_time_of_day}}, to the body of your email template will render as Good morning, if someone opens the email at 9:00am. |
Advanced Dynamic Variables With Custom Date Operators
Please note, custom fields and dynamic variables that leverage custom date operators are only available for customers on Basic, Professional, and Custom plans. If you would like to upgrade your plan, please 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.
Please note, these Advanced dynamic variable types only work on date-type fields. They will not work for other type fields.
Imagine that you have created a custom field for the date of your yearly product announcement that takes place on October 19, 2021, called Product Announcement
. Since that custom field includes a month, day, and year, you can use custom date operators in a dynamic variable to extract specific pieces.
The dynamic variable {{product_announcement->day}}
renders as 19
in the opened email. If you used the dynamic variable {{product_announcement->month}}
, it renders as October
in the opened email. The dynamic variable {{product_announcement->year}}
renders as 2021
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 since October 19, 2021, falls on a Tuesday.
Example Use Case For Advanced Dynamic Variables
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.
Please note, we formatted the text in the example below with code formatting to offset the dynamic variables from the plain-text copy and line breaks between each conditional logic statement for ease of reading. In an actual dynamic variable for an Apollo sequence task, you should write a dynamic variable as one continuous line.
Hi
{{#if first_name}}{{first_name}}{{#else}}there{{#endif}}
,We know many companies like
{{#if industry == Marketing}}Sparks, Jumpshot, and Deepcrawl {{#else}}{{#if industry == Big Data}}Heap Analytics, Palantir, and KeenIO {{#else}}Snowflake Computing, Uber, and Lyft{{#endif}}{{#endif}}are looking for new tools to implement for {{now_year->plus_1}}, and we'd like to walk you through our platform to 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?
Take a look at each of the individual dynamic variables and what they're doing in the email template:
Nested Dynamic Variables Pointing to Specific Field Values
To begin, the {{#if first_name}}{{first_name}}{{#else}}there{{#endif}}
dynamic variable sets up a fallback for the first name to render as there
in the event that there is no first name data available for the recipient who opens the email.
The {{#if industry == Industry Marketing}}Sparks, Jumpshot, and Deepcrawl
portion of the dynamic variable tells Apollo to render the text as Sparks, Jumpshot, and Deepcrawl
if the Industry field for the recipient who opens the email is Marketing
. If the industry is not Marketing
, Apollo moves on to the next piece of conditional logic.
The next portion of the dynamic variable, {{#else}}{{#if industry == Big Data}}Heap Analytics, Palantir, and KeenIO
, tells Apollo to render the text as Heap Analytics, Palantir, and KeenIO
if the Industry field for the recipient who opens the email 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}}Snowflake Computing, Uber, and Lyft
is the fallback if the recipient's Industry field does not match Marketing
or Big Data
. In this instance, the text renders as Snowflake Computing, Uber, and Lyft
in the opened email.
The final portion of the dynamic variable, {{#endif}}{{#endif}}
, closes the conditional logic. Two {{endif}}
statements are required since there are nested {{#if}}
statements.
{{endif}}
statements do I need?As a rule of thumb, for each {{#if}}
statement in your dynamic variable, you need a corresponding {{#endif}}
to close the dynamic variable.
Now-Time Dynamic Variables
Continuing through the body copy, the dynamic variable {{now_year->plus_1}}
tells Apollo to take the current year 2021
and add one year to it. When the recipient opens this email, this text renders as 2022
.
Next, the dynamic variable {{now_weekday->plus_2}}
tells Apollo to take the current day of the week and advance it by two days. If Apollo sends the email on a Monday, the text in the email renders as Wednesday
. If Apollo sends the email on a Tuesday, the text renders as Thursday
and so forth. If Apollo sends this email on a Thursday or Friday, the text will render the dynamic variable as Monday
because it is the next available weekday.
Subsequently, the {{now_weekday->plus_3}}
dynamic variable tells Apollo to take the current day of the week and advance by three 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 work 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 time of day for the recipient based on their local time in their local timezone (when it is available) and renders morning
, afternoon
, or evening
.