How to insert a dynamic image in an email (new editor)

Last updated at:

You will learn

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.

These steps refer to Klaviyo's new template editor. If you are working in a classic editor template, create a new template to use the new editor.

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. 

  1. Open the email template where you’d like to add the dynamic image.
  2. Click Preview and Test.
  3. 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.
  4. 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.
  5. Once you’ve copied your variable, drag an image block into your message.
  6. Click Browse > Dynamic Image.
  7. Paste the variable into the Dynamic variable or dynamic URL field.
  8. 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:


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:'' }}

Additional resources

Was this article helpful?
26 out of 68 found this helpful