You will learn
Learn about the Dynamic Image option in an email image block, including how to find the right personalization tag to use and add it to an email template.
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.
Store your images in a profile or eventStore your images in a profile or event
You can display dynamic images from event data (e.g., started checkout events for an abandoned cart flow) in metric-triggered flow emails. Images stored in event data cannot be displayed in campaigns or non-metric triggered flows, which can only use images stored on the recipient's profile as profile properties.
Storing images for campaigns and non-metric triggered flowsStoring 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 (e.g., https://www.klaviyo.com/static/klaviyo-social-share-image.jpg) must be stored in each recipient’s profile properties. You can add an image URL to their profile properties in the following ways:
Storing images for metric-triggered flowsStoring 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:
Add a dynamic image to an emailAdd a dynamic image to an email
Once you’ve stored your dynamic image information in Klaviyo, identify the correct tag to use to include it in your email.
- Open the email template where you’d like to add the dynamic image.
- Click Preview and Test.
- If your image variable is stored as a custom property, click Search for a Profile and find a profile that has an image stored as a custom 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 tag, drag an image block into your message.
- Click Browse > Dynamic Image.
- Paste the tag into the Dynamic variable or dynamic URL field.
- Finally, preview your email to ensure that the tag 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 2 ways to add a backup image:
Use the missing product filterUse 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 imageSet 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
- How to add personalization into text blocks
- How to build dynamic blocks in a flow email
- How to create a metric-triggered flow
- How to embed assets directly in an email