Klaviyo supports a large number of message template tags (sometimes called merge tags) that you can use. More specifically, Klaviyo supports most of the filters used by the Django template language, along with some custom ones as well. For a more comprehensive guide to using the Django template language in a Klaviyo context, see our Getting started with template tags and variable syntax. You can also check out our how-to on using filters to customize variables and our glossary of variable filters.
When creating message 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.
|Template Variable||Hi George Washington, your email is [email protected]...|
|Template Tag||Update preferences | View in your browser|
|Template Filter||Hey friend, any interest in some hawaiian pizza with extra anchovies?|
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, along with an unlimited number of custom properties. Additionally, you can choose a
default value to fill in for missing values
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 George, ...|
|Hi there, ...|
You can also use someone's last name the same way as first name.
|Your last name is Washington.|
Or, if you want someone's entire name, you can get their full name.
|Your full name is George Washington.|
This one's pretty self-explanatory.
|Your email address is [email protected].|
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 blue.|
|Your favorite TV show is unknown.|
Account variables allow you include information about your company or organization in your email. You can manage this information on your account page.
|You received this message from the United States of America.|
|Our address is 1600 Pennsylvania Avenue Washington D.C. 20500.|
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.
|Thanks for your purchase of $29.00.|
|How do you like your new blue suede shoes?|
List and campaign tags allow recipients to manage their subscription preferences and view your campaign in their browser.
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.
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.
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.
|Want to update your preferences? Click here.|
|This is a fancy manage preferences link.|
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.
Inserts the current day of the month.
For example, first day of the month would be: 1.
|The current day of the month is 1.|
Inserts the current day of the week. Currently, we only support English names.
|Today is Sunday|
Inserts the current month.
For example, January would be: 1
|The current month is 1.|
Inserts the name of the current month. Currently we only support English names.
|The current month is January.|
Inserts the current year.
|The current year is 2021.|
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. For a deeper dive into conditionals, head to Use Conditionals In Messages.
If-else blocks allow you to control what content someone receives in their email based on a variable's value.
Like dogs? Check out some great toys for your canine.
Like cats? Check out some great toys for your feline.
|Like dogs? Check out some great toys for your canine.|
For blocks allow you to iterate over each the item in a variable that's storing a list and render them individually.
|Oversized Beach Blanket × 1|
Beach Chairs × 4
30 SPF Sunscreen × 2
20" Plastic Cooler × 1
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 separated with a pipe character
|. Some filters take an argument. In those cases, after the filter use a colon
: and then surround the argument with single quotes
Below are some common use cases and examples.
This filter is used for looking up properties on people or events.
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 friend, ...|
In addition to all the filters above, Klaviyo supports 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 25.5 points.|
Updated over 1 year ago