Overview

This article is mainly a list of examples you can use as reference for event variable use in Klaviyo. The guides linked below contain more detailed explanations of what event variables and how to use them.

Table of Contents

1. Event variables

1.1. Variable arrays

1.2. Array numbers

1.3. Specific variables

1.4. Creating a product entry with event variables

2. Dynamic variables

2.1. Custom dynamic block

3. Shareable results page URL

Event variables will only work on Octane AI Plus, as they require the quiz completed event to pull data from.


1. Event variables

Event variables are made up of several components and each can be manipulated to change which part of a customer's product recommendation is represented.

Although there are several ways you could use and reference event variables if you're tech savvy, the basic template below can be used for most common use cases.

Template

Example

{{ variable array, variable number, specific variable }}

{{ event.products_all.0.title }}

The highlighted text in the screenshot above represents different parts of the 'quiz completed' event data:

  • Blue represents the variable array, which is a grouping of event variables.

  • Yellow is the array number, which points to a specific product entry.

  • Red is the specific variable, which can refer to the specific part of the quiz completion data that you want to reference.

In this example, event.products_all is the array that includes the products that were included in this specific quiz completion. 0 is the first product recommended in the result, while title will pull that product's specific name.

1.1. Variable arrays

An event variable can use a variable array to call products from a customer's specific recommendation, or from specific product blocks on a results page.

Example

What does it do?

Array

{{ event.products_all.2.image }}

Pulls the image of the 3rd product from a subscriber's personalized results page.

products_all

{{ event.products_block1.0.link }}

Pulls a link to the product page of the 1st product listed in the second content block of the subscriber's results page.

products_block1

When calling a specific product block, the product block does not have to be visible in the subscriber's personalized recommendations to be used with this array as long as the array is valid for the specific results page included in the quiz completion event.

In the example above, if I wanted to reference the name of the product in the second product block, I would use the event variable {{ event.products_block2.0.title }}. This can be useful if you want to consistently reference a specific product from your quiz results.

If you only want to show products from someone's specific recommendation, using the products_all array should suffice.

To change the content block that the array targets, you can change the number in the products_block1 array from 1 to 2, 3 and so on.

1.2. Array numbers

Array numbers represent each product contained inside of an array. The first entry starts at 0, and each product after that counts up by 1 from there.

Example

What does it do?

Array number

{{ event.products_all.0.title }}

Shows the name of the 1st product in the personalized result.

0

{{ event.products_all.1.title }}

Shows the name of the 2nd product in the personalized result.

1

{{ event.products_all.2.title }}

Shows the name of the 3rd product in the personalized result.

2

If an array number references a product entry doesn't exist (such as using the array number 3 in a recommendation that only had two products) a blank space will be shown instead.hen emails will display a blank space a blank space will be shown instead.

1.3. Specific variables

Specific variables are the final part of an event variable. While the variable array tells the email which set of products to look at, and the array number points at the specific product inside of a set, specific variables represent a specific portion of a product as it was shown in an Octane AI quiz.

What does it do?

Specific variable

Name

title

ID

id

Product page URL

link

Image

image

Price (formatted in default currency)

price_formatted

Description

description

Tags

tags

Type

type

Specific variables are added into an event variable after the array number. In the example below, the array number 2 is used since this is the third product in the recommendation.

When manually putting together a product entry in Klaviyo's template editor, each of these specific variables can be used in tandem to pull the exact components you need to make the product's content dynamically show up in an email.

Example

What does it do?

Specific variable

{{ event.products_all.1.image }}

Shows the the image of the 2nd product in the personalized result.

image

{{ event.products_block1.1.price_formatted }}

Shows the price of the 2nd product in the 1st product block.

price_formatted

{{ event.products_block4.2.link }}

Inserts a link to the page of the 3rd product in the 4th product block.

link

1.4. Creating a product entry with event variables

If you know how to build content with HTML and CSS, there are many ways you can add dynamic products to an email. However, even if you're only using Klaviyo's drag-and-drop email editor, you can use event variables to build dynamic products inside of an email template.

The way you do this is by adding event variables into an appropriate content block in Klaviyo's email editor. For example, to display a specific product's image, you would add its event variable into an image block.

You'll only need four event variables to add a dynamic product with an image, name, price and product link to an email.

Image block

What does it do?

{{ event.products_all.0.image }}

Shows the image of the 1st product in a personalized result.

Text block

What does it do?

{{ event.products_all.0.title }}

Shows the name of the 1st product in a personalized result.

{{ event.products_all.0.price_formatted }}

Shows the price of the 1st product in a personalized result (in the store's default currency).

Button ("Full URL" or "URL" field)

What does it do?

{{ event.products_all.0.link }}

Adds a link to the webpage of the 1st product in a personalized result.

Back to top.


2. Dynamic variables

You can turn an event variable into a dynamic variable inside of one of these blocks:

  • Dynamic tables: fill out a single-row table with event variables which will repeat in your email for every product shown in a personalized result.

  • Repeating blocks: set a content block to repeat for every product shown in a personalized result.

Dynamic variables are made by creating a shortcut to a product array that you can use in a dynamic table or repeating block.

Dynamic tables

After adding a table to an email template, you can use a setting to turn it into a dynamic table.

After changing the block to Dynamic under the Rows tab, you'll have to fill in a couple of fields in the Data Source screen.

Field

What does it do?

Row collection

Add the product array, i.e. event.products_all or event.products_block1

Row Alias

Custom entry. This will be the name of your dynamic variable.

Once you fill in these fields, the row alias will be the name of your dynamic variable and can be used by replacing the product array and array numbers in an event variable.

Using the screenshot above, here's a quick comparison between a normal event variable and a dynamic variable:

Example

What does it do?

Variable type

{{ event.products_all.0.description }}

Shows the the product description of the 1st product in a personalized result.

Event variable

{{ products.description }}

Shows the product description of all products in a personalized result. Number of blocks depends on number of products.

Dynamic variable

Repeating block

Any type of block can be made repeating. If you're building products in an email using repeating blocks, you'll need to add all of your content inside of a single block (text block is recommended).

After toggling a block's repeat settings to "on", then you just need to fill out the following fields:

Field

What does it do?

Repeat For

Add the product array, i.e. event.products_all or event.products_block1

Item Alias

Custom entry. This will be the name of your dynamic variable.

Once you save your changes, the item alias will be the name of your dynamic variable and can be used by replacing the product array and array numbers in an event variable.

Adding a dynamic variable in a repeating block works the same way as it does with dynamic tables. In the screenshot above, I would use to {{ products.price_formatted }} to add product prices as a dynamic variable.

2.1. Custom dynamic block

Here's a simple example of a dynamic block created from scratch using event variables and code:

{% for products in event.products_all|slice:':10' %}
<p style="text-align: center;"><a href="{{ products.link }}" target="_blank"><img alt="" src="{{ products.image }}" style="width: 150px; height: 150px;" /></a>‚Äč</p>

<h2 style="text-align: center;"><a href="{{ products.link }}" target="_blank">{{ products.title }}</a></h2>

<h4 style="text-align: center;">${{ products|lookup:'price_formatted' }}</h4>

We only recommend building emails with HTML and CSS for technically savvy users, or those with access to a developer. The code above only contains basic styling, but is an example of how code can be used to create a dynamic block from scratch.

Back to top.


3. Shareable results page URL

"Quiz completed" Klaviyo events include a direct link to the results page that a subscriber has seen when they finished the quiz.

Example

What does it do?

Specific variable

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

Inserts a link to the personalized results page represented by the event.

'quiz results URL'

The link used here is shareable but will only show a snapshot of the results page. A different link is used for each personalized version or whenever you make a change to a results page.

Back to top.


Have any questions? Send an email to [email protected] or use the support icon to chat with our team.

Did this answer your question?