About Using Event Variables to Personalize Flows

Last updated at:


Learn about the different actions your customers take, and how you can use that data for creating personalized messaging flows in Klaviyo. For instance, you could use event data in an abandoned cart flow message to show individuals what product they left behind, an image of the item, and more. This allows for a more personalized experience for the customer, as well as a higher chance of conversion.

In this article, you will learn what dynamic event data is, when to use it, where to find it, and how to include it in your flow messages.

About Event Variables

When you have an integration with a third-party service or tool, Klaviyo records certain metrics when a customer profile takes an action. What actions Klaviyo tracks depends on your integration, but common ones include Started Checkout, Placed Order, and Viewed Product. In addition, each metric recorded in Klaviyo includes relevant information about the event, which is called metadata.

For example, when a customer begins to check out, Klaviyo will track this as a Started Checkout event. Klaviyo is periodically sent details from the third-party platform about the item(s) left in the cart, quantity of each item, total, images, etc. In Klaviyo, this data is stored as event variables and includes all of the information associated with an action a specific customer took.

When You Can Use Event Variables

Because event variables are based on a customer’s behavior, they can only be used in metric-triggered flow messages.

List-, segment-, and date property-triggered flows are not triggered by events, but by information about the customer in their profile. Thus, there are no event variables to pull from and use in a flow email or SMS. Similarly, event variables cannot be used in campaigns, as these are manual, one-time sends and are not based on the action a customer took.

Common examples of metric-triggered flows include:

How to Find Event Variables


Choose the SMS or MMS you want to add an event variable to. Next, click Configure Content.

  Inside an SMS or MMS event variable in a flow, below the section for Content a  button for Configure Content so you can add an event variable

Clicking Configure Content will take you to where you can add text, emojis, static or dynamic images, and GIFs to your message. Here, you can also insert profile properties and event variables.

SMS Preview for SWAK Lip Care with content message options on the left hand side and visual preview on the right side

You can find event variables on the right-hand side of the screen in the Previewing tab. This tab shows the 10 most recent events that you can navigate between; e.g., for a post-purchase flow, the 10 most recent Placed Order events will show here.  

More importantly for this article, the Previewing tab will also show all the associated event variables. To view the variables, click the View details button in the upper right-hand corner of the tab.

When inside an SMS or MMS, navigate to the Previewing tab in the upper right-hand side and hovering on the info icon to see the View Details action

This dropdown will contain information all of the variables for that event. By clicking any line item, you can automatically copy it to your clipboard, making it easy to add event variables into your message. 

Inside the Previewing tab in the upper-right-hand side, click on the info icon to expose the Event Properties details below in the modal


In a flow, you first need to select the email in which you want to show the dynamic event data. Next, click Configure Content > Edit Content.

Are you using Klaviyo’s new template editor? Head to our new editor resource center.


An example of a flow email where you need to click on the button in the upper right above the email body section labeled Edit Content

Once in the email template editor, click Preview on the left-hand side. You’ll see a popup saying, Choose a recent event to preview with. In the window, you will see a recent event that corresponds with the flow's trigger. For example, in an Abandoned Cart flow email, the preview window will show a recent Started Checkout event. If you want to look at the data for a different event, toggle left and right using the arrow buttons.


This preview window will show all of the data available for that particular event metric. To view a specific event variable, click on any line of data to reveal the associated template variable. The variable will appear within a gray box at the bottom of the window. List entries are numbered starting at 0 (not 1, as this information is brought over in an array), and this number does not equal the item quantity. For instance, if {{ event.extra.line_items.0.product.name }} is the variable entry for an image, the 0 indicates that it is the first item in the array (and not that there is no product images)

To use event variables, you must copy them exactly. Event variables are case-sensitive, and the slightest deviation from how it appears in the preview window could cause the variable not to work.

If you want to view the dynamic event data for an item in an abandoned cart email, click the first item under Items. In this case, the first item is MATTE COLOR LIP BALM - PEACH and the variable is {{ event.Items.0 }}.

Inside the Preview Email modal, to view the dynamic event data for an item in an abandoned cart email, click the first list item under Items

Common Examples of Event Variables

The syntax for different event variables depends on both the integration and event metric. You can see the syntax for all of the available variables for a given event by scrolling through the preview window and clicking on the different entries.

Some common examples of variables by integration are listed below for a Started Checkout event. Keep in mind that the exact variable may differ depending on the metric used to trigger the flow. 

Product Name/Title {{ event.extra.line_items.0.product.name }}
Product URL {{ event.extra.items.0.product.url }}
Image {{ event.extra.items.0.product.images.0.src }}
Price for Product  {{ event.extra.line_items.0.product.price }
Quantity {{ event.extra.line_items.0.quantity }}
Total {{ event.extra.total_inc_tax }}

Magento 1

Magento 2

Product Name/Title

{{ event.extra.line_items.0.product.name }}

{{ event.extra.line_items.0.product.name }}

Product URL

{{ event.extra.line_items.0.product.key }}

{{ event.Items.0.Product.FullURL }}


{{ event.extra.line_items.0.product.images.0.url }}

{{ event.extra.line_items.0.product.images.0.url }}

Price for Product 

{{ event.extra.items.0.base_original_price }}

{{ event.extra.line_items.0.product.price }}


{{ event.extra.line_items.0.quantity }}

{{ event.extra.line_items.0.quantity }}


{{ event.extra.base_grand_total }}

{{ event.extra.base_grand_total }}

Product Name/Title {{ event.extra.line_items.0.product.title }}
Product Handle {{ event.extra.line_items.0.product.handle }}
Image {{ event.extra.line_items.0.product.images.0.src }}
Price for Product  {{ event.extra.line_items.0.line_price }}
Quantity {{ event.extra.line_items.0.quantity }}
Total {{ event.extra.customer.total_spent }}
Product Name/Title {{ event.extra.Items.0.Name }}
Product URL {{ event.extra.Items.0.URL }}
Image {{ event.extra.Items.0.Images.0.URL }}
Price for Product  {{ event.extra.Items.0.LineTotal }}
Quantity {{ event.extra.Items.0.Quantity }}
Total {{ event.extra.Items.0.TotalWithTax }}

*You can rebuild carts from an abandoned cart flow in WooCommerce by using the parameter ?wck_rebuild_cart={{ event.extra.CartRebuildKey }}. Cart rebuilding is also available for Shopify and Magento 1 integrations but is pregenerated in the default abandoned cart flows.

Event Variable Arrays (Email Only)

If you add the variable above to an email, you can pull in the dynamic data for the first item left in the cart. It is similar to going up to a line of people and asking the first person their name. This approach works well if there can only be a single item; however, it is time-consuming for multiple items or when you don’t know how many items someone might add.

Ideally, you would want to use a single command to get all of the event variables for items within a group instantly — like being able to call out “Name” and getting the names of everyone in a long line.

When it comes to a list of event variables, arrays allow you to do just that.

An array occurs when there are multiple entries under one umbrella property (like multiple items in an order). As mentioned above, the first item will have a "0" at the end (or potentially in the middle), the next item will have a "1," and so on. Using an array, you can capture information about both the umbrella property (e.g., Items or Collections) and the individual entries under that property.

In the example below, there are three items in the preview for a Placed Order event:

  • The variable for the "Sweet Tarts" item is {{ event.Items.0 }}
  • The variable for the "Runts" item is {{ event.Items.1 }}
  • The variable for the "Nerds" item is {{ event.Items.2 }}

For this example, the event variable array for these items is event.Items.

An example of events data inside the Preview Email modal where the event.items variable array shows different candy items

Another example is an event variable for an image, which allows you to display a dynamic image of a product.

An example of events data inside the Preview Email modal where the events variable for an image shows the image URL path

For {{ event.extra.line_items.0.product.images.0.src }}, the list for the image (blue) is event.extra.line_items — also called the collection or variable array — and the image itself (orange) is product.images.0.src in that list. Yellow indicates the array number.

Iterating over Dynamic Event Variables (Email Only)

There are two different ways of iterating over these or other event variable arrays in emails:

  1. The Block Repeat Feature
    This feature allows you to add a single block (text, image, etc.) that will automatically repeat itself and iterate over all entries in a property array.
  2. A Dynamic Table
    This helps you create a more complex block that loops over all entries for a single variable array. 

Note that while you can add dynamic event variables to text messages, you cannot iterated over multiple ones. 

Additional Resources

Was this article helpful?
467 out of 831 found this helpful