Skip to main content
All CollectionsIntegrationsKlaviyoπŸ“• Using the Klaviyo Integration
Customizing Octane AI Data in Klaviyo Templates with Filters
Customizing Octane AI Data in Klaviyo Templates with Filters

#integrations #klaviyo #quiz

Mark Baek avatar
Written by Mark Baek
Updated over a week ago

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


πŸ’‘ 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

default:'<insert default text>'

{{ first_name|default:'friend' }}

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

striptags

{{ event.products_all.0.description|striptags }}

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

slice

{{ event.products_all.image.slice:':3' }}

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

lower

{{ event.products_all.0.title|lower }}

All letters are lowercase.

title

{{ first_name|title }}

The 1st letter of all words in the product title are capitalized.

truncatechars

{{ event.products_all.0.title|truncatechars:10 }}

If the product title is longer than 10 characters, the rest of the text is replaced by "...".

truncatewords

{{ event.products_all.0.description|truncatewords:5 }}

If the product description has a word count longer than 5 words, the rest of the text is replaced by "...".

upper

{{ event.products_all.0.title|upper }}

All letters are uppercase.

urlizetrunc

{{ event|lookup:'quiz results URL'|urlizetrunc:15 }}

If the inserted URL is longer than 15 characters, the rest of the URL is replaced by "..." while remaining clickable.

Did this answer your question?