Skip to main content

Dynamic Content Block Variants in Klaviyo

Written by Ana Bunaiasu

Lantern allows dynamic content block variants to be sent to Klaviyo upon quiz completion. This feature helps you personalize your emails dynamically, based on the relevant variant that was displayed to your customers on the quiz results page.

How It Works

Each variant created within a dynamic content block in Lantern has a unique Variant ID and an optional Variant Nice Name. When a quiz is completed, Lantern sends the IDs or Nice Names of the winning content block variants to Klaviyo as part of the Completed Lantern Quiz (v2) - your-quiz-handle event. Each quiz sends its own event, named with that quiz's URL handle.

Image showing the Variant ID field highlighted in a Lantern dynamic content block along with the variant nice name set to variant_kitten, which is used to identify winning variants sent to Klaviyo.

If the Variant Nice Name field is left blank, the Variant ID will be sent to Klaviyo by default. If a Nice Name is provided, it will be sent to Klaviyo instead of the Variant ID.

Key Data Sent to Klaviyo:

Lantern sends quiz completion data to Klaviyo that includes information about which dynamic content block variants were shown. This is represented in the event data under winner_variants, together with winner_scores, which holds each block's winning variant score (the same number shown in place of [score] on the results page). Both are sent on the event and saved on the Klaviyo profile. The event always includes them. To turn off the profile copy, use the Content block results checkbox under Profile properties on the quiz's Klaviyo card. Find out more in Klaviyo Integration.

Image showing event data sent to Klaviyo, highlighting the

If a Variant Nice Name isn’t provided, the winner_variants array will contain Variant IDs instead.

Image showing event data sent to Klaviyo, highlighting the

This allows you to:

  • Personalize email content based on the variant displayed on the results page.

  • Automate email flows tailored to distinct customer preferences.

Show one block's products in an email

When a results content block has a name, the Klaviyo quiz event also carries that block's own products, in the order and count the results page shows them. This lets an email show only the products of one block, for example the main recommendation without a bundle block, which the single products list can't do. These products are sent on the Klaviyo event only, not to the profile or other integrations.

To use them:

  1. In the content block window, enter a name in the Block name (optional) field. Use letters, numbers and underscores.

  2. Publish the quiz. A new name reaches emails after publishing.

  3. In Klaviyo, add a dynamic table block and set its row collection to the value below, replacing your_block_name with your block's name.

event.products_by_block.your_block_name

If a named block wasn't shown on the results page, it sends an empty list.

Setting Up Dynamic Content in Klaviyo

In our example, we'll use a pet food quiz tailored with 6 dynamic content block variants, focusing on different life stages of pets: three variants for dogs (puppy, adult, senior) and three for cats (kitten, adult cat, senior cat). Here’s how we can customize the content of our Klaviyo email based on which variant was displayed on the results page:

1. Using Klaviyo's Display Logic with Sections

Utilize Klaviyo's built-in show/hide logic to tailor content in emails based on the Variant Nice Name.

Steps to Implement:

1.1. In the Klaviyo email editor, create a separate section of content for each content block variant, such as one for puppies, another for adult dogs, etc. You can include any type of content you want inside a section such as images, buttons, dividers etc, but in our example, we’ll only add text.

Image showing Klaviyo email editor with different text sections created for each variant type such as puppy, adult, or senior dog.

​
1.2. For each section, navigate to Display settings and under Show/hide logic, click the Use code option to input custom display conditions.

Image showing the Display settings tab inside a Klaviyo email section, where the show/hide logic option is selected using custom code.

1.3. Enter the condition to check if the Variant Nice Name is in the winner's array.

"Variant Nice Name" in event.winner_variants

This logic ensures that the section only displays if the quiz results page shows the correct variant.

In our example, for the puppy diet section, our condition will be:

Image showing code input inside Klaviyo to display a section only if a specific Variant Nice Name exists in the

You can copy the correct Variant Nice Name from inside your content block.

1.4. Repeat this process for each section.

Image showing where to copy the Variant Nice Name from inside the Lantern content block editor.

Example:

If a quiz participant's results indicate they have a puppy, the puppy variant will be included in the winner_variants array sent to Klaviyo. In the email template, the section with puppy-specific content will only display if this variant name is found in the array, meaning quiz rakers will only see this section if it is shown to them on their results page.

2. Using Flow Triggers and Filters

Create distinct flows for different pet types using Klaviyo's Flow Builder.

Steps to Implement

2.1. Create a New Flow: In Klaviyo, initiate a new flow triggered by the "Completed Lantern Quiz (v2) - your-quiz-handle" event. Each quiz sends its own event, so pick the one for your quiz.

Image showing a new Klaviyo flow being created, triggered by the


2.2. Set Up Trigger Use Trigger Filters to segment the flows based on specific content block variant IDs. To do this click the Add button next to the Trigger filters option.

Image showing the location of the

2.3. On the next screen, click Add Trigger filter.

Image showing the trigger filter configuration panel in Klaviyo where a new filter can be added.

2.4. Enter the correct filter based on the variant ID by following these steps:

2.4.1. Select the dimention winner_variants

2.4.2. Set the rule as contains

2.4.3 Select the correct 'Variant Nice Name' from the drop-down. In our case, this will be the puppy variant

Image showing how to select the dimension

Please note: to have all available Variant Nice Names in this drop-down, you must first complete the quiz and make sure each variant was presented as a result. This is the only way the information will be sent to Klaviyo, and the ‘Variant Nice Name’ will be present in the drop-down.

2.5. Save your trigger filter then Save your new flow

Image showing the final step of saving the trigger filter and flow after configuring it based on a Variant Nice Name.

2.6. Customize Email Templates: Develop customized email templates for each variant. For the puppy variant, the email content might focus on puppy nutrition, training tips, and suitable products for puppies.

Image showing an email template in Klaviyo being customized with content tailored for the puppy variant.


​
In our case, there are six distinct variants (three for dogs and three for cats), and we will need to set up six separate flows. So this solution is suitable if you have a relatively small number of variants.

Example for Implementing Puppy Flow:

Flow Name: Puppy Food Recommendations
​Trigger Condition: winner_variants contains ‘Variant Nice Name’ for PUPPY
​Email Content: Include tips, and product recommendations specifically beneficial for puppy care and development.

Common Questions

Q: What happens if I don’t add a Variant Nice Name?

  • The Variant ID will be sent to Klaviyo instead.

Q: Can the full content of the winning dynamic content block be sent to Klaviyo?

  • No, due to API payload limitations and HTML formatting challenges, only the variant information (Variant Nice Name or Variant ID, depending on which is available) is sent.

Q: What if multiple content blocks are used in a quiz?

  • All winning Variant Nice Names are included in the array, enabling personalized content based on multiple quiz results.

  • Only blocks shown on the shopper's results page are included. A hidden block, or a block where no variant matched, sends nothing.

  • A variant with Include product recommendations unticked is still listed in winner_variants but sends no products.

Q: Can multiple emails be triggered based on quiz results?

  • Yes, different flows can be set up using trigger filters based on specific Variant Nice Names to cater to diverse customer needs.

Q: In what order are recommended products sent to Klaviyo?

By using Variant Nice Names, you can personalize your Klaviyo emails with clear, descriptive targeting that aligns with each quiz result.

Did this answer your question?