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:
- An active Klaviyo account.
- An active Digioh account.
- 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:
- Navigate to your Klaviyo dashboard, select the
Email Templates
option. - Click on Create Template.
- Choose a template that suits your needs and click Create Template.
- Within the template editor, you can click on a text block to start editing it.
- 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 theresult_name
list from Digioh into your email. - Or in Preview and test you can click on the nested object value to copy the merge tag in your clipboard
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:
- Use a merge tag that corresponds to the data you want to include.
- 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.