How to Insert a Dynamic Image in an Email (new editor)

read
Last updated at:

Overview

Learn about the Dynamic Image option in an email image block, including how to find the right variable to use and add it to an email template. 

dynamic image option.jpg

Dynamic images allow you to customize each recipient’s message based on data stored in their Klaviyo profile or event data. For example, you can use this feature to display an item they recently added to their cart in a flow triggered by the Added to Cart metric. Or, by storing a unique image URL in a subscriber’s profile, you can show that custom image in campaigns you send them.

Access Klaviyo’s new template editor from the Email Templates tab by clicking Create Template > Use New Editor. After creating a template with the new editor, you can customize and send it as a campaign or use it in flow emails by selecting the new template in the campaign or flow setup process.

In the coming weeks, you’ll have the option to convert your existing email templates to the new template editor as well.

Store Your Images in a Profile or Event

Storing Images for Campaigns and Non-Metric Triggered Flows

To display a dynamic image in a campaign or non-metric triggered flow (i.e., a flow triggered by a list, segment, or date), an image URL must be stored in each recipient’s profile properties. You can add an image URL to their profile properties in the following ways: 

  • Uploading a CSV of profile data 
  • Using a third-party integration 
  • Using Klaviyo’s APIs

Storing Images for Metric-Triggered Flows

To display a dynamic image in a metric-triggered flow (e.g., a flow triggered by an Add to Cart event), you can either use profile data stored using the methods outlined above, or use event data from the metric that triggers the flow. 

Note that event data can only be used in a flow triggered by that event. 

You can add event data to Klaviyo in the following ways: 

  • Through a default Klaviyo integration
  • Through a third-party integration 
  • Using Klaviyo’s APIs

Add a Dynamic Image to an Email

Once you’ve stored your dynamic image information in Klaviyo, identify the correct variable to use to include it in your email. 

To get started, open the email template where you’d like to add the dynamic image. Then, click Preview and Test

If your image variable is stored as a profile property, click Search for a Profile and find a profile that has an image stored as a profile property. Scroll through their properties until you find the image variable, then click the variable name to copy it. 

If your image variable is stored within an event’s data, click Event. Select your event from the dropdown. Note that this message must be sent through a flow triggered by the same event or the dynamic image will not appear. Scroll through the event data until you find the image variable. Then, click the variable name to copy it. 

Once you’ve copied your variable, drag an image block into your message. Click Browse > Dynamic Image, and paste the variable into the Dynamic variable or dynamic URL field. 

create_dynamic_image.gif

Finally, preview your email to ensure that the variable is working correctly. If you don't see your image, double check that you’ve selected an event or profile that contains the variable you used. 

Add a Backup Image

If you aren’t confident that every email recipient will have an image available in their profile or event data, consider using a backup image so the area doesn’t appear blank. There are two ways to add a backup image: 

Use the Missing Product Filter 

Add the missing product filter to the end of your dynamic image variable to use Klaviyo’s default backup image. To add this filter, add |missing_product_image after the dynamic image variable, like this: 

{{ event.image_url|missing_product_image }}

If anyone who receives the email is missing an image, they’ll see this instead:

missing_image.png

Set Your Own Backup Image

To choose your own backup image, apply the default filter with an image URL of your choosing. This will display your custom backup image if a recipient doesn’t have an image set. To add this filter, add |default:'' to the end of your image variable with your custom image URL between the single quotes, like this: 

{{ event.image_url|default:'www.example.com/custom_image_url.jpg' }}

Additional Resources



x
Was this article helpful?
0 out of 1 found this helpful