Customizing and Personalizing Your Emails

Klaviyo supports a large number of email template tags (sometimes called merge tags) that you can use. They are grouped into different sections so you can browse them quickly.

Use the navigation to the right to find the email tags you're looking for.

Terminology — variables, tags and filters

When creating email templates, Klaviyo provides a few different ways to customize content so it looks great and is more relevant to your recipients. Klaviyo provides template variables you can use to personalize the content. The most commonly used variables allow you to include information about the recipient, such as their name, email address or custom properties you've stored about that person.

In addition to variables, you can also use different template tags that will output important links or information. These tags are useful when you want to insert unsubscribe links, share links, dates and more. Other tags allow you to create that is only shown if certain conditions are met or allow you to create loops to iterate over content. A few examples are on the right, but a full list of available tags, grouped by function, is below.

Finally, Klaviyo provides template filters that are used with template variables to provide additional functionality, including accessing custom properties for recpieints, default values and additional formatting options.

Examples

Hi {{ first_name }} {{ last_name }}, your email is {{ email }}...

Hi George Washington, your email is george.washington@example.com...

{% manage_preferences %} | {% web_view %}

Update preferences | View in your browser

Hey {{ first_name|default:'friend' }}, any interest in some {{ person|lookup:'Favorite Food' }}?

Hey friend, any interest in some hawaiian pizza with extra anchovies?

Personalization Variables

Because Klaviyo focuses on people and what they're up to, personalization is built into Klaviyo's core and making emails more relevant to reach recipient is easy. There are a number of different variables you can use.

First Name

In the first example, the person we're sending to has the first name "George." In the second example, we don't know the recipient's first name, so we use the default filter to provide a placeholder.

Hi {{ first_name }}, ...

Hi George, ...

Hi {{ first_name|default:'there' }}, ...

Hi there, ...

Last Name

You can also use someone's last name the same way as first name.

Your last name is {{ last_name }}.

Your last name is Washington.

Full Name

Or, if you want someone's entire name, you can get their full name.

Your full name is {{ full_name }}.

Your full name is George Washington.

Email Address

This one's pretty self-explanatory.

Your email address is {{ email }}.

Your email address is george.washington@example.com.

Custom Properties

If you've added extra properties to individuals, you can use them with the person variable and the lookup filter. It's usually a good idea to also provide a default value in case someone doesn't have the custom property you're trying to use by including the default filter.

Your favorite color is {{ person|lookup:'Favorite Color' }}.

Your favorite color is blue.

Your favorite TV show is {{ person|lookup:'Favorite TV Show'|default:'unknown' }}.

Your favorite TV show is unknown.

Account Variables

Account variables allow you include information about your company or organization in your email. You can manage this information on your account page.

Examples

You received this message from {{ organization.name }}.

You received this message from the United States of America.

Our address is {{ organization.full_address }}.

Our address is 1600 Pennsylvania Avenue Washington D.C. 20500.

Event Variables

For flows based on metrics, templates also have a variable that represents the event that triggered that email. This allows you to use information about that event in your email. For example, if you want to thank someone for their purchase and reference the specific products they bought, you can easily do that with Klaviyo.

If you're sending events to Klaviyo via the API, all of properties for those events are available through the event variable and lookup filter.

For integrations with other services, Klaviyo automatically stores detailed information for you. The information captured is specific to each service and metric. You can see what properties are available while you're creating your flow email by clicking on "Preview." In that dialog, we'll show you the properties for that event.

Examples

Thanks for your purchase of ${{ event|lookup:'total_price' }}.

Thanks for your purchase of $29.00.

How do you like your new {{ event|lookup:'Items Purchased' }}?

How do you like your new blue suede shoes?

List & Campaign Tags

List and campaign tags allow recipients to manage their subscription preferences and view your campaign in their browser.

Unsubscribe

Klaviyo requires an unsubscribe link on all campaigns. To include an unsubscribe link, you can use the unsubscribe tag. By default, the link will have the text "Unsubscribe." If you want to customize the text in the link, this tag takes an optional parameter that allows you to customize the text. If you need even more control, there is also a tag that provides only the URL for the unsubscribe link.

When a recipient clicks the unsubscribe link, they're taken to a page to confirm their unsubscribe request. You can see everyone who has unsubscribed in the People section of Klaviyo.

{% unsubscribe %}

Unsubscribe

No longer want to receive these emails? {% unsubscribe %}.

If you'd no longer like to receive emails, click here.

This is a fancy <a href="{% unsubscribe_link %}" style="color:red;">unsubscribe</a> link.

This is a fancy unsubscribe link.

Web View

To give recipients a link to a web page that has your campaign, you can use the web view tag. Like the unsubscribe tag, if you need more control, there is also a version that just provides the URL.

{% web_view %}

View in Your Browser

Can't see this email? {% web_view 'Open in your browser' %}.

Can't see this email? Open in your browser.

This is a fancy <a href="{% web_view_link %}" style="color:green;">web view</a> link.

This is a fancy web view link.

Manage Preferences

For standard lists, you can create a preferences page and customize it to match your brand. This allows recipients to update their preferences. To include a link to this page for each recipient, use the manage preferences tag. If you need more control, there is also a version that just provides the URL.

{% manage_preferences %}

Manage Preferences

Want to update your preferences? {% manage_preferences 'Click here' %}.

Want to update your preferences? Click here.

This is a fancy <a href="{% manage_preferences_link %}" style="color:orange;">manage preferences</a> link.

This is a fancy manage preferences link.

Date Tags

Date tags give you a quick way to insert the time of a campaign into an email. The date is in the timezone of your account.

Current Day

Inserts the current day of the month.

For example, in the US/Eastern timezone, this is currently 22.

The current day of the month is {% current_day %}.

The current day of the month is 22.

Current Day of the Week

Inserts the current day of the week. Currently we only support English names.

For example, in the US/Eastern timezone, this is currently Thursday.

The current day of the week is {% current_weekday %}.

The current day of the week is Thursday.

Current Month

Inserts the current month.

For example, in the US/Eastern timezone, this is currently 6.

The current month is {% current_month %}.

The current month is 6.

Current Month Name

Inserts the name of the current month. Currently we only support English names.

For example, in the US/Eastern timezone, this is currently June.

The current month is {% current_month_name %}.

The current month is June.

Current Year

Inserts the current year.

For example, in the US/Eastern timezone, this is currently 2017.

The current year is {% current_year %}.

The current year is 2017.

Conditional Tags

Conditional tags allow you to conditionally include content in your campaigns. They give you powerful controls for personalizing your campaigns to each individual recipient and, if your email is a flow triggered by what someone did, include information from that event.

If-Else Blocks

If-else blocks allow you to control what content someone receives in their email based on a variable's value.

{% if person|lookup:'Interested in Dogs?' %} Like dogs? Check out some great toys for your canine. {% else %} Like cats? Check out some great toys for your feline. {% endif %}.

Like dogs? Check out some great toys for your canine.

For Blocks

For blocks allow you to iterate over each the item in a variable that's storing a list and render them individually.

{% for item in event.shopping_cart_items %} {{ item.name }} × {{ item.quantity }} {% endfor %}.

Oversized Beach Blanket × 1
Beach Chairs × 4
30 SPF Sunscreen × 2
20" Plastic Cooler × 1

Basic Filters

Filters allow you to modify how a variable is displayed. You'll notice they go directly after a variable. The variable and filter should be separted with a pipe character (|). Some filters take an argument. In those cases, after the filter use a colon (:) and then surround the argument with quotes.

Below are some common use cases and examples.

Lookup

This filter is used for looking up properties on people or events.

{{ person|lookup:'Birthday' }}.

July 8th

${{ event|lookup:'Total Spent' }}.

$19.99

Default

This filter is used to specify a default in case a variable doesn't have a value. This is useful as placeholder when you don't always have the information you want to use, e.g. someone's name.

Hi {{ first_name|default:'friend' }}, ...

Hi friend, ...

Floatformat

In addition to all the filters above, Klaviyo support most of the filters used by the Django template language. As an example of one of the filters included, the floatformat filter allows you to format numbers.

You earned {{ event|lookup:'Points Earned'|floatformat:1 }} points.

You earned 25.5 points.