In Emarsys you can create email campaigns in the Custom HTML Editor, where you need to manually insert the HTML code of your email. Here you can use ESL codes for personalization as well.
You can also edit HTML code in the Template Editor, where you can drag and drop template blocks to build your campaign. In the Template Editor, you can edit content blocks in HTML and add ESL codes to them as well.
ESL in the VCE and Template Editor
In this example, we will show you how to use ESL variables on an email template level to check a contact's registration language field and display a text based on that value.
{% if contact.35==1 %} Welcome dear customer
{% elseif contact.35 == 2 %} Willkommen, lieber Kunde!
{% else %} Bienvenido, querido cliente!
{% endif%}
The email your contact will receive will display the greeting in a specific language depending on the value of the contact data field no. 35.
Note: If you add ESL codes to an HTML comment tag <!--
-->
within the content block, it won’t work in plain text emails.
For example, the following ESL code will not work in plain text emails:
<!--
{% if contact.35 == 1 %}
{% set ctatext = 'SHOP NOW' %}
{% elseif contact.35 == 2 %}
{% set ctatext = 'ZUM PRODUKT' %}
{% elseif contact.35 == 3 %}
{% set ctatext = 'ACHETER MAINTENANT' %}
{% elseif contact.35 == 4 %}
{% set ctatext = 'ACQUISTA ORA' %}
{% elseif contact.35 == 8 %}
{% set ctatext = 'COMPRAR AHORA' %}
{% else %}
{% set ctatext = 'SHOP NOW' %}
{% endif %}
You can also create ESL variables for the contact’s registration language field on an email template level with applying placeholder texts, instead of adding the whole ESL snippet to the email body.
In the following example, you can see how to set up CTA text variables on an email template level:
<!--
{% if contact.35 == 1 %}
{% set ctatext = 'SHOP NOW' %}
{% elseif contact.35 == 2 %}
{% set ctatext = 'ZUM PRODUKT' %}
{% elseif contact.35 == 3 %}
{% set ctatext = 'ACHETER MAINTENANT' %}
{% elseif contact.35 == 4 %}
{% set ctatext = 'ACQUISTA ORA' %}
{% elseif contact.35 == 8 %}
{% set ctatext = 'COMPRAR AHORA' %}
{% else %}
{% set ctatext = 'SHOP NOW' %}
{% endif %}
-->
You need to add the code snippet to the content block’s HTML Editor.
Using ESL in the Custom HTML Editor and in VCE
Editor-specific details
The Emarsys Scripting Language is supported by both the Custom HTML Editor and the Visual Content Editor (VCE). However, you cannot edit HTML codes in VCE.
You can edit ESL and HTML in the Template Editor and in the Content Block Editor.
Old template-based campaigns do not support HTML and ESL.
Important: When you are inserting ESL code into an HTML block, please note that operators are case sensitive and they should always be in lower case: "and", "or".