Use filters to manipulate personalization tags
Sometimes the custom fields we have stored on a profile need tweaking for it to present better make sense in the context of your message. You can apply filters to variables in Klaviyo to make changes like adding default text, capitalizing letters or adding title case, formatting a date, or splitting a value into pieces. To add a filter to a variable, use this format:
{{ your_tag|filtertext }}
Check out the list below for some of the most popular filter use cases.
Set a default value when a personalization tag is empty
Filter text: default
Format: {{ your_tag|default:'friend' }}
When to use it: This is one of the most popular filters because it adds a default value when other data is not available for a particular tag. Most notably, brands will use “friend” as default text for a first name if a profile does not have a first name stored.
Make all text lowercase
Filter text: lower
Format: {{ your_tag|lower }}
When to use it: If you have data stored with varying levels of capitalization for a certain profile property, you can easily change all characters within the string to lowercase.
Make all text uppercase
Filter text: upper
Format: {{ your_tag|upper }}
When to use it: If you have data stored with varying levels of capitalization for a certain profile property, you can easily change all characters within the string to uppercase.
Show a certain number of decimal places on a number
Filter text: floatformat
Format: {{ your_tag|floatformat:# of decimal places to display }}
When to use it: If your Klaviyo account is integrated with other systems, it’s possible that numeric values may sync into your account with or without the desired number of decimal places. Easily add or remove the number of decimal places displayed using this filter.
Change a timestamp into a reader-friendly date
Filter text: format_date_string
Format: {{ your_tag|format_date_string }}
When to use it: Often, tech platforms will store dates as UTC timestamps, which can be hard to read and understand. Clean up timestamps and format them with the exact date and time layout that you want using this filter. Explore all options for date and time filtering here.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article