Skip to main content
Skip table of contents

Zeta Markup Language (ZML)

Zeta Markup Language (ZML) is based on the open-source template language Liquid created by Shopify. ZML is used in the Zeta Marketing Platform to perform personalization and dynamic operations within the content. ZML code can be categorized into objects, tags, and filters.

Objects

Objects tell ZML where to show content on a page. Objects and variable names are denoted by double curly braces: {{ and }}. This is how user properties can be populated within the content to perform basic personalization.

Input

{{ first_name }}

Output

Ryan

In this example, ZML is rendering the content of an object containing the user property called first_name, and that object contains the string, Ryan.


Tags

Tags are used to define logic within the content. They are denoted by curly braces and percent signs: {% and %}. This markup used in tags usually does not produce any visible text. Possible exceptions are noted below. This means that you can assign variables and create conditions and loops without showing any of the ZML in the content.

Input

{% if first_name %}

Hello {{ first_name }}!

{% endif %}

Output

Hello Ryan!

Tags can be categorized into several types. You can read more about each type of tag in their respective sections.


Filters

Filters change the output of a ZML object. They are used within an output and are separated by a |.

Input

{{ first_name | default: "Valued Customer" }}

Assuming first_name is null or doesn't exist:

Output

Valued Customer

Multiple filters can be used on one output. They are applied from left to right.

Input

{{ "ryan!" | capitalize | prepend: "Hello " }}

Output

Hello Ryan!


Points to Remember

Use Single Quotes for String Values in Global Variables

When assigning string values with the global tag, use single quotes:

CODE
{% global displayed = 'store' %}

Using double quotes can produce unexpected output because the double quote may be treated as part of the stored value:

CODE
{% global displayed = "store" %}

This can result in output such as:

CODE
"store

For this reason, string values assigned with global should always use single quotes.

Global and Assign Have Different Scope, Not Different String Parsing

Both global and assign are used to create variables, but they serve different purposes:

CODE
{% assign displayed = 'store' %}

creates a variable that is available only within the current component or template scope.

CODE
{% global displayed = 'store' %}

creates a variable that can be referenced across message components such as the subject line, preheader, and content.

The primary difference is scope, not how string values are parsed.

Global Variables Do Not Support Filters

Unlike assign, the global tag does not evaluate filters when assigning values.

For example:

CODE
{% assign first_name_upper = first_name | upcase %}

stores the transformed value.

However:

CODE
{% global first_name_upper = first_name | upcase %}

stores the literal text:

CODE
first_name | upcase

instead of the filtered result.

If a value requires filters, apply the filter using assign or directly in the output expression.

When to Use Global vs Assign

Use global when a variable must be shared across multiple message components via the Global Variables field.

Use assign when the variable is only needed within a single content block or template.

Snippets in the Global Variables field must use the global tag to be available throughout the message. The assign tag creates locally scoped variables and will not make values available across components.

Campaigns include a standalone Global Variables field that allows you to define variables that can be referenced across all message components, including the subject line, preheader, and content.

Use the global tag when a variable needs to be shared across multiple message components:

CODE
{% global my_var = 'value' %}

Use the assign tag when a variable is only needed within a single component:

CODE
{% assign my_var = 'value' %}

Snippets placed in the Global Variables field must use the global tag to make variables available throughout the message. Variables created with assign are scoped locally and are not available outside the component in which they are evaluated.

Note: When assigning string values with the global tag, use single quotes ('value'). Filters are not evaluated in global assignments and are stored as literal text.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.