Tutorial

Building a dynamic table block using event data

Building a dynamic table block using event data
Userlevel 4
Badge +3

Displaying relevant products is a staple of any email marketing strategy. None is more important than the use of a dynamic table block to highlight products users have abandoned or have purchased.

Dynamic event data will only show when the email is inside of an event based flow (abandoned cart, etc). For this example, I will be talking about abandoned cart, but this process can be used with other event triggers as well. This data shows information on what the customer did when on your website. In a flow email, add in a table block. Under table settings, turn to Dynamic. Go to preview tool for started checkout, find the repeating beginning variable for each item. IE: for price, name, quantity each of these begin with ‘event.extra.line_items’. This repeating string will be used for the row collection under table settings. Add in just the repeating string for row collection, nothing else. So, event.extra.line_items under row collection. Row alias can be anything you want, this one word will represent the whole ‘event.extra.line_items’ string. I suggest adding in ‘item’ for row alias. So, everytime ‘item’ is used in the dynamic table, it is actually loading in ‘event.extra.line_items’. We do this so that all products in someone’s abandoned cart can load in, rather than just the first item.

Now, to bring in specific product information, go to preview, copy ‘product name’ (or any variable, you want to pull in). Paste into the text portion of the dynamic table, and replace the whole first string with ‘item’, your row alias. So if the product name in the previewer is ‘ event.extra.line_items.product.title’ you change this in the text block to ‘item.product.title’. Now, this will load in all product title’s in someone’s abandoned cart. 

This process can be repeated for any variable in the previewer. Note: for product price, to have the price formatted as $X.XX, remember to add |floatformat:2 into the string. Ex: {{item.price|floatformat:2}}. You can pull in any information that is available in the previewer, if the information is not available in the previewer, then it cannot be pulled in because Klaviyo is not capturing it. Also please note, this example was based on Shopify. Other integrations may use a different repeating string/names for variables but the premise remains the same; find the repeating factor, use this for row collection, set a row alias, and then add the content to the table with the row alias and the individual variables.

Don’t like the horizontal format of a dynamic table block? Don’t worry, I got you covered on how build a dynamic table block that vertically stacks next time!

Additional Resources:


11 replies

Badge

So this dynamic product cannot be inserted into a standard email, it must be a flow??

Userlevel 4
Badge +3

Hi Gianna - nope! A regular product block can be added to any email template/campaign. Only dynamic tables based off an event on your website (such as Abandoned Cart, Back in Stock, etc) need to be in a flow message for their accompanying flow event/trigger. IE: If youre building an abandoned cart table, it needs to be in an abandoned cart flow. Thanks!

Badge

Hi Ana! 

I want to know how to do that with WooCommerce. I tried with similar options but when I tested it, didn’t work. Do you have any tutorial with woocommerce?
Also I tried to use the Klaviyo's flow templates but I didn’t find one that shows the products in the email. The only that worked with this type of dynamic content was the Viewed Product Flow

How can I do?

Thanks!

Userlevel 7
Badge +60

Hi @DanielaMartinez24

 

Thanks for your question! 

 

Yes, you are correct, the ‘line items’ event variable is only connected to specific integrations such as Shopify, BigCommerce, and Magento. Woocommerce uses the Product Name/Title event variable shown below, mentioned in our help center documentation.  For more info, I’d check out a fellow member’s similar question below! 

{{ event.extra.Items.0.Name }}

 

You’re spot on again! You were only able to create the dynamic table it in the ‘Viewed Product’ Flow because it is a metric-triggered flow, which is mentioned in our how to build dynamic blocks in a flow email documentation Anna linked above. A dynamic table can only be created when customer event data, which is pulled from the trigger action in a metric-triggered flow, is present. Since there isn’t a trigger to pull in customer event data in our templates’ section you weren’t able to create this feature.

 

Hope that clarifies! 

-Taylor

Hi Ana,

Great video! I am experiencing an issue. I was able to configure the dynamic table but I am building a flow that shows only a specific item category(for example, I want the dynamic table to only display shirts but not shirts and pants in the cart). How do I achieve this?

Userlevel 7
Badge +60

Hi there @Tedd

 

Thanks for sharing your question with us! You can definitely achieve this in Klaviyo! Essentially, you’ll be interested in utilizing our if/else blocks. When navigating into your dynamic block go to Column 2 > Source > and add this code into the Source text block for Column 2.

 

 

It's essentially saying: "if 'Shirts' is in the product title, populate this table block with the product. I would be careful of having all the right spaces and letters since any slight errors might render it unsuccessful! I’d also consider creating this as a new flow 

 

Thanks for participating in the Community!

-Taylor

Badge +3

Hello, I'm curious where the return to cart button leads? About the cart page or about the checkout page

Userlevel 7
Badge +60

Hi @duyen1616

 

Great question! 

 

The destination a URL takes you to in an Abandon Cart flow email all depends on the flow trigger action. If the trigger action  for an Abandoned Cart flow is the ‘Started Checkout’ metric, the URL will rebuild the customers cart when clicked and take them to their checkout page. The Add to Cart metric will not take a customer to their rebuilt cart or checkout page because that specific information wasn’t passed through the trigger. 

 

Hope that helps!

-Taylor

Hi Taylor! This was very helpful! I have a little consultation, when I change the trigger from "Abandoned Checkout" to "Abandoned Cart" all my variables change and I´m unable to do what you explained, do you have any advice? Thank you so much in advance!

Userlevel 7
Badge +60

Hi there @CD2023

 

Happy to help! 

 

In order to clarify what the issue is and how to help you further do you mind clarifying a few points for me?

  1. What do you aim to accomplish or what do you want to recreate that I explained? There have been a few differnt questions in this thread!
  2. What integration is your store?
  3. What are the different trigger metrics for each flow?

 

Thanks for participating in the Community!

-Taylor 

Badge +2

hello, i am just starting with klaviyo and super confused with all these dynamic flows. 
I am building a product review flow (without the klaviyo review app), so it is a flow that is triggered by the  shipment delivery +30days. 
I want all items that the person ordered with pictures and a further “review product” link going to the product page where the person can leave a review.
When I am trying to build the table as showed in the video from scratch I am only getting a product name, my question is  - how to add an image of each product? as i cannot find the “image” code in the side bar of the event
sorry, I am VERY low tech with all this coding 😰 please help 

Reply