Skip to contentSkip to navigationSkip to topbar
On this page
Looking for more inspiration?Visit the
(information)
You're in the right place! Segment documentation is now part of Twilio Docs. The content you are used to is still here—just in a new home with a refreshed look.

HTML Editor


(information)

Engage Premier End of Sale

Engage Premier entered an End of Sale (EOS) period effective June 10, 2024 and is no longer available for new customers. Existing Segment customers have access to and support for Engage Premier until Segment announces an end-of-life (EOL) date. Segment recommends exploring Twilio Marketing Campaigns(link takes you to an external page), as well as Segment's preferred ISV partners, including Airship(link takes you to an external page), Braze(link takes you to an external page), Klaviyo(link takes you to an external page), Bloomreach(link takes you to an external page), and Insider(link takes you to an external page).

Use the HTML Editor to design your email template with both code and visual editing capabilities. Build your email template with code, copy and paste existing code, or use the Visual Editor for a code free design experience.

On this page, you'll learn how to use the HTML Editor to build personalized email templates for your Engage campaigns.


Getting started

getting-started page anchor

You can navigate to the HTML Editor in two ways:

  • When you build a new email template or edit an existing one.
  • From a Send Email step in a Journey.

From the Select Editor screen, select HTML Editor and click Build Email.


Use the Visual Editor for a no-code option to design your email. With the Visual Editor, you can:

Engage updates any changes you make in the Visual Editor to the HTML Editor in real-time.

Insert an image

insert-an-image page anchor

To insert an image from the Visual Editor:

  1. Select the image icon in the Visual Editor toolbar.
  2. Add the image URL source and alternative text.
  3. Edit the image width and height.
    • You can also click and drag the corners of the image to resize it in the Visual Editor.
  4. Click Save.

Preview for desktop or mobile display

preview-for-desktop-or-mobile-display page anchor

To preview your email template, click the preview icon in the Visual Editor toolbar.

From the preview screen, you can toggle between desktop or mobile to view the email in both displays.


Use the HTML Editor to maintain your email template with code. Copy and paste existing code or build a new template in the editor.

Engage displays any changes you make in a preview screen to the right of your code. You can preview your email in both desktop and mobile display.

Click Format at any time to properly indent and format your code in the HTML Editor.

(information)

Info

When you toggle from the HTML Editor to the Visual Editor, Engage may make minor changes to your code formatting. If Engage re-formats your code, it will not affect the email layout.

Error flagging and content validation

error-flagging-and-content-validation page anchor

Engage displays in-line error flags in the code editor to help you debug your code. If there are errors, you might not see content as expected in the preview screen until you've debugged your code.

For all content editors in Engage, you'll see alerts for any issues in your template, such as invalid profile traits or incorrect liquid syntax(link takes you to an external page). Engage both flags template issue(s), and displays recommended next steps. While you can save these templates, you must fix any issues before using them in Engage campaigns.


Personalize with merge tags

personalize-with-merge-tags page anchor

Add merge tags to personalize your message with user profile traits.

  1. From the text toolbar in the Visual Editor, click the Merge Tags drop-down menu.
  2. Select profile traits to add to the merge tags.
  3. Based on cursor placement, Engage adds merge tags to your template.
(success)

Success!

You can also add merge tags to your email right from the code editor.

Engage supports liquid templating to create dynamic content in the HTML Editor.

For example, use {% if %}, {% elseif %}, and {% else %} tags to call a product by name if known, or use a default message:

1
{% if profile.traits.product_title == "Sneakers" %}
2
Hey, view our latest sneakers!
3
{% elsif profile.traits.product_title == "Sandals" %}
4
Hey, check out these sandals!
5
{% else %}
6
Hey, check out our latest footwear.
7
{% endif %}

If you use liquid templating, be sure to test your email to make sure that everything renders properly.

(success)

Success!

While both the HTML and Visual Editor support liquid templating, Segment recommends using the HTML Editor to write liquid templating.

(warning)

Warning

Engage doesn't support liquid template syntax that produces partial blocks of HTML.

To view more examples related to your use case, visit the LiquidJS docs(link takes you to an external page).


From the editor screen, you can click Use HTML Editor or Use Visual Editor to toggle between the two editors.

The Visual Editor renders your HTML in an editable preview (similar to an email client), so you might need to accept formatting changes to your HTML to use the Visual Editor. In this case, Segment displays a confirmation modal with HTML differences.

Potential HTML changes include formatting, removing attributes with potentially unsuported scripts in your HTML (for example, onclick or onblur), attribute reordering, and adding missing tags.

If you don't want to accept the changes required to use the Visual Editor, you can continue editing in the HTML Editor.

In the HTML Editor, you can use the Format button to properly indent and format your code. Note that the Format button may not implement all changes necessary to use the Visual Editor.


After you design the email, click Create Email Template. You can navigate to Engage > Content > Templates to view and maintain your email template.


(warning)

Warning

Once you create an email with the HTML Editor, you can't modify it with the Drag and Drop Editor, and vice versa.