Klaviyo's event variables can be used & modified for more control over your dynamic content. This guide will go over some of the tricks you can use.
π‘ What you'll learn
Using filters to modify Klaviyo variables (jump to section)
β
π‘ Prerequisites
Event variables take advantage of Octane AI's custom quiz completed event which is available on Octane Plus.
Using filters to modify Klaviyo variables
Filters are bits of code you can add to the end of an event variable to modify the data being pulled in by the variable.
For example, the variable for one of your product's titles, {{ event.products_all.0.title }}
could be turned all uppercase by adding |upper
to the end, which would turn the variable into {{ event.products_all.0.title|upper }}
.
Examples of some useful filters are listed below.
π‘ Personalizing emails with profile properties
An easy way to add variables from profile properties is with the Add personalization button available in Klaviyo's text blocks.
These variables will let you insert quiz answers & a quiz result URL dynamically into emails.
π Default
The default
filter will fill in the variable space with text if there's no data available.
Filter | Example | What it does |
|
| If there is no first name in the profile, the text "friend" gets inserted instead. |
π Striptags
The striptags
filter will remove any HTML tags inserted by a variable.
This is useful for removing any HTML tags that Shopify may have passed over with your product description.
Filter | Example | What it does |
|
| All HTML tags included in the product description is removed. |
π Slice
The slice
filter limits how many items from a list will be displayed.
This is useful when using dynamic content settings in Klaviyo to limit the number of products that appear.
To learn how to create a dynamic block in Klaviyo, check out this guide.
Filter | Example | What it does |
|
| This makes the maximum possible number of product images pulled from quiz results into 3. |
π Additional filters
These are some additional filters that can be used to modify variables.
Filter | Example | What it does |
|
| All letters are lowercase. |
|
| The 1st letter of all words in the product title are capitalized. |
|
| If the product title is longer than 10 characters, the rest of the text is replaced by "...". |
|
| If the product description has a word count longer than 5 words, the rest of the text is replaced by "...". |
|
| All letters are uppercase. |
|
| If the inserted URL is longer than 15 characters, the rest of the URL is replaced by "..." while remaining clickable. |