Klaviyo Dynamic Email Template – Display your product recommendations in your email

This document will guide you through the process of creating dynamic email templates in Klaviyo, using nested object merge tags, and integrating this process with data sent from Digioh. This allows for more customized and personalized content within your emails, greatly enhancing your email marketing strategy.

What You’ll Need

Before you start, make sure you have:

  1. An active Klaviyo account.
  2. An active Digioh account.
  3. Properly structured data in Digioh. The data should be formatted into nested objects like this:
    {
    "result_name": [
        "Pink Lady Apple Kombucha", 
        "Citrus Immune Boost", 
        "Berry Lemonade", 
        "Guava Dragon Fruit",
        ...
        ]
    }
    

Step-by-step Guide

Step 1: Understanding Nested Object Merge Tags in Klaviyo

Nested object merge tags allow you to pull specific pieces of data into your email templates. A merge tag in Klaviyo might look like this: {{ event.results.result_name.0|default:''}}. Here’s what this means:

  • event is the name of the event or object that contains the data.
  • results is a function that retrieves a specific piece of data from the nested object.
  • 'result_name' is the key in the object that you’re trying to access.
  • '0' is the index of the value you want to retrieve if the value is a list.

Step 2: Creating Dynamic Email Templates with Nested Object Merge Tags

To create dynamic email templates using nested object merge tags:

  1. Navigate to your Klaviyo dashboard, select the Email Templates option.
  2. Click on Create Template.
  3. Choose a template that suits your needs and click Create Template.
  4. Within the template editor, you can click on a text block to start editing it.
  5. To add a merge tag, you can type it directly into the text box. For instance, you could use {{ event.results.result_name.0|default:''}} to pull the first value from the result_name list from Digioh into your email.
  6. Or in Preview and test you can click on the nested object value to copy the merge tag in your clipboard

Image merge tags

Step 3: Sending Nested Objects from Digioh

We are sending the data to the nested object “results” for the recommendations as follows

  • result_name
  • result_sku
  • result_url
  • result_image

Step 4: Populating Results with Merge Tags

To populate your emails with the data from Digioh:

  1. Use a merge tag that corresponds to the data you want to include.
  2. If you want to include the first item from the result_name list, you would use {{ event.results.result_name.0|default:''}}.

Remember that the number in the lookup function corresponds to the index of the item in the list. If you wanted to include the second item, you would use ‘1’, and so on.

Conclusion

By utilizing Klaviyo’s powerful nested object merge tags feature, you can create dynamic, personalized email templates that pull directly from your Digioh data. This creates a more engaging and personalized experience for your email recipients, ultimately enhancing your marketing efforts.