You will learn
Learn what dynamic event data is, when to use it, where to find it, and how to include it in your flow messages. 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.
About event variablesAbout 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.
You must have an integration installed for event data to appear. Learn more about Klaviyo-built integrations or using Klaviyo APIs to build a custom integration.
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:
- Abandoned cart, via the Started Checkout metric
- Post-purchase, via the Placed Order metric
- Product review, via the Placed Order metric
- Browse abandonment, via the Viewed Product metric
- Winback, via the Placed Order metric
- Add to cart, via the Added to Cart metric
How to find event variables
SMSSMS
- In the flow builder, click the SMS or MMS you want to add an event variable to.
- Next, click Configure Content.
- Click Configure Content to view where you can add text, emojis, static or dynamic images, and GIFs to your message. Here, you can also insert profile personalization and event variables.
- 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.
- 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.
- This dropdown contains information on 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.
Emails
To add event variables in a flow email:
- Open the email in the flow editor.
- Click Edit Content.
- Click Preview and Test.
- Click on a property name from the Event Properties menu to copy it.
- Paste the tag into your flow email.
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.
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.
BigCommerce | |
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 }} |
Image |
{{ 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 }} |
Quantity |
{{ event.extra.line_items.0.quantity }} |
{{ event.extra.line_items.0.quantity }} |
Total |
{{ event.extra.base_grand_total }} |
{{ event.extra.base_grand_total }} |
Shopify | |
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 }} |
Shop Currency (base currency of the store) | {{ event|lookup:'$currency_code' }} |
Presentment Currency (currency the customer used) | {{ event.extra.presentment_currency }} |
WooCommerce* | |
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" in the middle or at the end, 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.
Iterating over dynamic event variables (email only)Iterating over dynamic event variables (email only)
There are two different ways of iterating over these or other event variable arrays in emails:
-
The content 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. -
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 resourcesAdditional resources
- Find out more about using message personalization
- See how to include a dynamic image in an MMS
- Learn how to iterate over an event array:
- SMS marketing strategies for all levels