When your contacts perform specific actions, such as making a purchase or booking a meeting, you can use the event data linked to these actions to personalize the emails they receive. This is especially useful in order confirmations, abandoned cart reminders, and other automated emails.
How does personalizing emails with event data work?
When creating an email template, you can add event variables. These variables are dynamic placeholders for specific details related to an event, such as the contact's name, order ID, and purchased items.
When the event happens, Brevo receives the event data and automatically replaces the event variables with the actual data from the event. This ensures that, instead of receiving a generic message, the recipient gets a fully personalized email, making the experience more relevant and engaging.
In the following example, a customer placed an order with two products. The event variables in the email template were replaced with the actual data from the purchase, so the recipient received a fully personalized email, including specific details about the items she ordered ⬇️.
| Email template in Brevo | Email received in the inbox |
|---|---|
Which emails can be personalized with event data?
Since event data is based on a customer’s actions, event variables can only be used in:
- Automated emails sent through an automation.
- Transactional emails sent through Brevo SMTP.
Expand the following accordion to view some concrete examples of emails that can use event data for personalization ⬇️:
| Triggering event | Event data | |
|---|---|---|
| Order confirmation email | A customer places an order |
|
| Order cancellation email | A customer's order is cancelled |
|
| Shipping confirmation email | A customer's order is shipped |
|
| Abandoned cart reminder | A customer abandons their cart without completing the purchase |
|
| Upcoming event, appointment, or trip reminder | A customer books an event, appointment, or trip |
|
| Next step suggestion | A customer, user, or student completes a specific action |
|
| Product or content recommendation | A visitor visits a specific page, blog post, or article |
|
Before you start
-
Install the Brevo tracker on your website
To track user actions and collect event data, make sure the Brevo tracker is installed on your website. To learn more, check our dedicated article What is the Brevo tracker and how to install it?. - (Optional) Create custom events
Brevo automatically tracks many events. However, if you want to monitor specific user actions relevant to your business, you can create custom events and collect data linked to them. To learn more, check our dedicated article Create custom events in Brevo.
Step 1: Create an email template
First, create an email template.
- Go to Marketing > Templates.
- Click Create template.
- Select Email template.
- In the Setup tab, configure the settings of your template, including its name, subject line, and preview text.
💡 Good to knowYou can personalize your subject line with event data by typing an event variable manually. To learn more about how event variables are formatted, check our dedicated section in the article [Manual] Personalize your messages with dynamic content (Brevo Template Language). - Click Next step.
- In the Design tab, choose an email template or layout to use as your base, or create a new template from scratch.
Step 2: (Optional) Insert a dynamic content block to repeat event data
Use a dynamic content block when you need to repeat information, such as the names or prices of purchased items. This lets you display multiple items as a list by looping through the event data.
- From the email editor, drag and drop the Dynamic content block into your canvas. The block settings open in the left panel.
- Click the Dynamic content section in your email template.
- From the Data source dropdown, select Event data.
- Choose the event you want to use for personalizing your email (e.g., eCommerce events > order_created).
-
Choose the specific array where the event data is stored (e.g., items).
Step 3: Add event variables to your email template
Add event variables to your email to include personalized data, such as product names, prices, or a cart link. When the email is sent, these variables will be replaced with the correct information for each recipient.
- Insert the content blocks you want to use to display the event data. For example, you can use:
- An Image block to show a picture of the items.
- A Text block to display details, such as the item names, prices, or descriptions.
- A Button to redirect to a personalized URL, such as a checkout or order summary link.
❗️ ImportantTo repeat event data, such as the names or prices of purchased items, make sure to place the content blocks inside the dynamic content block you added in the previous step.
-
Add event variables inside your content blocks. Expand the following accordions to learn how to add variables for each type of content:
🔠 Add a variable to textAdd a variable inside a content block containing text to display specific details related to an event, such as an item price or a cart total.
- Click a Title, Text, or Button block.
- Place your cursor where you want to add a variable.
- Click the Add variable { } icon in the formatting bar.
- From the Which attribute would you like to insert? dropdown, select the variable you want to include in the email template ("name", "price", etc.).
- (Optional) In the Which value should be used if the attribute is empty? field, enter the fallback text to use in case the value is missing for a product.
- (Optional) If you selected a number-type attribute, enter the desired number of decimals in the Number of decimals to display field.
- Click Insert. The variable will be inserted, and a tag will appear in your content block.
🖼️ Add a variable to an imageAdd a variable to an Image block to display the image associated with an item, such as a product photo.
- Click an Image block.
- From the sidebar, go to Image settings.
- In the Insert image from URL field, click the Add variable { } icon.
- Select the variable you want to use to display your image (usually "image").
🔗 Add a variable as a hyperlink on textAdd a variable as a hyperlink on text to send recipients to a URL, such as a product page or a cart summary.
-
Click a Title or Text block.
- Highlight the text where you want to add the link.
- Click the Link 🔗 icon in the formatting bar.
- In the Link target field, click the Add variable { } icon.
- Select the variable you want to use to generate your link (usually "url").
- Click Insert.
🔗 Add a variable as a hyperlink on an imageAdd a variable as a hyperlink on an image to send recipients to a URL, such as a product page or a cart summary.
- Click an Image block.
- From the sidebar, go to Link settings.
- In the Link target field, click the Add variable { } icon.
- Select the variable you want to use to generate your link (usually "url").
- Click Insert.
🔗 Add a variable as a hyperlink on a buttonAdd a variable as a hyperlink on an image to send recipients to a URL, such as a product page or a cart summary.
- Click a Button block.
- From the sidebar, go to Link settings.
- In the Link target field, click the Add variable { } icon.
- Select the variable you want to use to generate your link (usually "url").
- Click Insert.
Step 4: (Optional) Limit the number of items repeated in your emails
If you added a dynamic content block to your email template, its content will repeat for each item included in the email. By default, the number of items shown is limited to 3. This helps keep the message clear and visually appealing, while preventing the recipient from feeling overwhelmed.
|
To change the limit:
|
Step 5: (Optional) Show or hide content in your emails based on specific conditions
Make your emails more relevant by showing or hiding content based on specific conditions. Only display content that matches each recipient’s device, contact details, event data, or data feed.
➡️ To learn more, check our dedicated article Show or hide content in your emails (Content visibility).
Step 6: Preview your email template with real data
We do not recommend using the View in inbox or Send test email options for emails personalized with event data. These options cannot be linked to real event data, so event variables will not be replaced.
Preview your email template to ensure it displays correctly in recipients' inboxes and that event variables are properly replaced with real data from an event.
- Click Preview & test.
- Select one of our test or preview option:
The "Preview as recipient" option lets you preview how your email will look for a specific contact by replacing contact variables with data from a selected contact and event variables with data from a manually entered JSON snippet.
- Select Preview as recipient.
- Select the contact you want to use to replace the contact variables.
- Activate the Add transactional JSON data.
- Enter the JSON snippet you want to use to replace the event variables. This data will replace the variables, and you will be able to preview the template with real event data.
- Once you're done previewing the email, close the window.
❗️ ImportantFor event variables to be replaced with actual data in your email template, the event must have happened at least once in the past.
The "Preview event" option lets you select a past event and use its actual data to replace the event variables in your email template.
- Select Preview event.
- Select the event that will trigger the automation. In this example, we'll select Ecommerce events > cart_updated.
- Select a past event you want to use to replace the event variables. The data from this event will replace the variables, and you will be able to preview the template with real event data.
- Once you're done previewing the email, close the window.
Step 7: Activate your email template and use it in Brevo
Activate your email template and use it in Brevo.
- From the email editor, click Save & quit to save your email template.
- Click Save and activate to activate your email template.
- You can now use your email template in different ways:
The event variables in your email will be automatically replaced with the relevant information for each recipient when the email is sent.
🤔 Have a question?
If you have a question, feel free to contact our support team by creating a ticket from your account. If you don't have an account yet, you can contact us here.
If you’re looking for help with a project using Brevo, we can match you with the right certified Brevo Agency partner.