# Sending quiz results to customers via Klaviyo

You can send your customers their quiz results using Klaviyo.&#x20;

This page details the steps of creating the email trigger in Klaviyo, the email's dynamic table, and the variables that you need to know to set up the dynamic content.&#x20;

{% hint style="warning" %}
**Caution**:&#x20;

To set up this feature, you need to be familiar with [custom variables](https://help.klaviyo.com/hc/en-us/articles/4408802597659#01FJZ2C75YSBRKE8DN87SG9R44) and [email flows](https://help.klaviyo.com/hc/en-us/articles/115002774932-Getting-Started-with-Flows#create-a-new-flow4) in Klaviyo.
{% endhint %}

## In this section <a href="#id-01fjz2c75yes3qpfrfgrxj8jex" id="id-01fjz2c75yes3qpfrfgrxj8jex"></a>

* [Before you begin](#before-you-begin)
* [Setting up the email in Klaviyo](#id-01fjz2c75yes3qpfrfgrxj8jex-1)
  * [Step 1: Create the trigger](#step-1-create-the-trigger)
  * [Step 2: Add the email template and table](#step-2-add-the-email-template-and-table)
  * [Step 3: Edit the dynamic table](#step-3-edit-the-dynamic-table)
* [Previewing your email](#id-01fjz2c75ynwaktks70450ncs7)
* [Showing your products using custom code](#how-to-show-your-products-using-custom-code)

***

## Before you begin

{% hint style="info" %}
**Note:**&#x20;

If you’re on a legacy Quiz Kit plan, then this feature is available for the **Basic** plan or higher.
{% endhint %}

Before you start setting up your email flow and dynamic blocks, you need to ensure you have completed the following:

* You have successfully [integrated Klaviyo with your Shopify store](https://support.quizkitapp.com/building-a-quiz/integrations/email-and-sms/klaviyo).&#x20;
* You have connected[ a Klaviyo mailing list](https://support.quizkitapp.com/integrations/email-and-sms/klaviyo#passing-quiz-submissions-to-your-klaviyo-list).
* At least one customer has completed the quiz so that custom properties start appearing. Once a customer profile gets created, their custom properties appear.
* Familiarize yourself with [Klaviyo's help doc and dynamic variables](https://help.klaviyo.com/hc/en-us/articles/4408802597659#01FJZ2C75YSBRKE8DN87SG9R44). You need them for this tutorial.

When you have successfully set up the email to use dynamic date, Quiz Kit passes you the following variables:&#x20;

* Result name
* Quiz name
* Quiz completion date
* Customer answers
* Discount code
* Products recommended
* Result URL

Familiarize yourself with [this doc](https://help.klaviyo.com/hc/en-us/articles/115005084927-Template-Tags-and-Variable-Syntax#custom-properties2) to see how to use these variables.

***

## Setting up the email in Klaviyo <a href="#id-01fjz2c75yes3qpfrfgrxj8jex" id="id-01fjz2c75yes3qpfrfgrxj8jex"></a>

After you've connected Klaviyo and have custom properties for your quiz, you can set up the flow and dynamic content in Klaviyo. [Learn more about how to add a dynamic table and metric-triggered flow in Klaviyo](https://help.klaviyo.com/hc/en-us/articles/4408802597659#01FJZ2C75YSBRKE8DN87SG9R44).

### Step 1: Create the trigger

1. From your Klaviyo dashboard, click **Flows**.
2. Click **Create Flow**.
3. Click **Build your own**.
4. Name your flow and click **Create Flow**.
5. Under **Select a trigger***,* click the **Your Metrics** tab, then click **API**.
6. Choose the event that should trigger your flow. Click **Quiz Completed** to trigger the email to be sent when the customer completes your quiz.
7. Click **Save**, then **Confirm and save.**

### **Step 2: Add the email template and table**

1. Under **Actions**, drag and drop the **Email** action into the flow.
2. Click the email, and in the right-hand menu, enter your email details.
3. Click Select template, choose one of the templates, then click **Use template**.&#x20;
4. From the left-hand menu under **Blocks**, drag and drop the **Table** block.
5. From the left-hand menu, click the **Styles** tab.
6. Under **Data**, click **Dynamic**.
7. In the **Row collection** text field, copy and paste `event.Products`.
8. In the **Row alias** text field, copy and paste `item`.
9. Click the **Content** tab.

### Step 3: Edit the dynamic table

{% hint style="info" %}
**Note**:&#x20;

To complete this step, you need to understand Klaviyo's custom variables.&#x20;

[Learn more about custom variables](https://help.klaviyo.com/hc/en-us/articles/4408802597659#01FJZ2C75YSBRKE8DN87SG9R44), or [contact Klaviyo support](https://www.klaviyo.com/contact-us) for questions.&#x20;
{% endhint %}

1. Click the **Content** tab to return to the table content editor.
2. Click on **Dynamic row** **1** or **2**, then click **Text** or **Image** to change the cell type.
3. Add any dynamic product variables that you want to include to the table.&#x20;

Below is an example of code for showing the "Result title": `{{ person | lookup: 'Result title' | default: '' }}`. You can set default value inside of '' if needed.

<figure><img src="https://3560167061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Ff4VSFR6mflh7oo1yyqTT%2Fuploads%2FnCE3iLvuhyklvvBZcCb8%2Fimage.webp?alt=media&#x26;token=a07e8ea1-0f0a-41d6-8723-87e133afc6d0" alt=""><figcaption></figcaption></figure>

***

## Previewing your email <a href="#id-01fjz2c75ynwaktks70450ncs7" id="id-01fjz2c75ynwaktks70450ncs7"></a>

When you've set up the email flow and dynamic table, you should preview and test the email to ensure it works as expected. To do so, from the Klaviyo email editor, click **Preview & test**.&#x20;

When you've ensured everything is working correctly, click **Done**.

{% hint style="info" %}
**Note**:

If there are any errors, check the spelling and structure of your variables, as well as your **Table Settings** tab.
{% endhint %}

***

## Showing your products using custom code <a href="#how-to-show-your-products-using-custom-code" id="how-to-show-your-products-using-custom-code"></a>

{% hint style="warning" %}
**Caution:**\
\
**For advanced users.** You need to be knowledgeable in coding to complete these steps.
{% endhint %}

To loop through the products and display the correct data, you need to use the "for" cycle: `{% for product in person.Products %}{{ product.title }}` - `{{ product. price }}{% endfor %}`&#x20;

In each product you can display:&#x20;

1. `product.title`
2. `product.price`&#x20;
3. `product.link`
4. `product.image`
5. `product.id`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://support.quizkitapp.com/building-a-quiz/collecting-customer-data/sending-quiz-results-to-customers-via-klaviyo.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
