Back to Help
email design

Inserting dynamic data with merge tags (using Liquid)

You can merge customer and event properties into outgoing emails in Vero.

To provide you with powerful templating options Vero uses Liquid, an open-source templating language created by Shopify. You can use Liquid to load dynamic content in your emails based on the data you have stored in Vero.

Merging basic data

In Vero, we use a prefix within the standard Liquid {{ template fields to denote where to load the data from. The two main prefixes for loading customer data:

  1. {{user.property}} replace attribute with the name of any customer property that you’ve captured using the Vero API or uploaded via CSV. For example, {{user.first_name}} would print John for a user profile that has the attribute first_name with value John.
  2. {{event.property}} replace attribute with the name of any event property you’ve captured with our API or uploaded via CSV. For example, {{event.product_name}} would print Apple MacBook Pro for an event that has the attribute product_name with value Apple MacBook Pro. Note that you can only access event attributes for the trigger event of a triggered email.

The prefixes user. and event. indicate whether the property being loaded is stored against the customer’s profile as a customer property or against an event the user has triggered.

Merge tags are replaced dynamically with the correct data when an email is prepared to be sent.

Merging event properties in emails

For example, Reba viewed Red Shoes would be {{user.first_name}} viewed {{event.product_viewed}}.

You can only insert event properties attached to the base event - that is, the event that triggers a Behavioral or Transactional campaign. You can view the list of properties you already track using our API by visiting the Logs page in Vero and selecting View Data under the drop down associated with a particular event line item.

For example: the event added product to cart might have a number of properties including product_name and image_url.

When creating campaigns in Vero – whether you’re using templates or standard rich text – you can insert dynamic variables using the Liquid Templating Language.

With all of the following variables, you can use the fallback option, such as {{user.first_name | fallback: 'there'}} as the option to use if the value is blank.

Vero specific merge data

There are some merge fields that support key Vero fucntions, including Vero’s one-click unsubscribe and View in browser (permalink) tools.

The following is a list of the key variables and functions you can use:

  • {{url.unsubscribe_link}} inserts a URL (e.g. http://getvero.com/unsubscribe/xyz) that unsubscribes your customers in one click.
  • {{url.unsubscribe}} inserts an anchor <a> tag containing the string Unsubscribe and pointing to the link referenced by {{url.unsubscribe_link}} above.
  • {{url.permalink_link}} inserts a URL (e.g. http://getvero.com/view-online/xyz) that points to an online, hosted version of each individual email that is sent through Vero.
  • {{url.permalink}} inserts an anchor <a> tag containing the string View in browser and pointing to the link referenced by {{url.permalink_link}} above.

Using Liquid functions

Vero is a complex and powerful templating language. Vero supports most of the functions outlined in the Liquid for Designers documentation.

We have extended the default functionality with a series of custom Liquid functions designed to help build better emails whilst making your life easier. We outline each of our custom functions in more detail in our article Custom Liquid Functions.

  • {{ user.email | encode }} allows you to URL encode the provided value. If user.email was equal to damien+test@getvero.com it would be rendered as damien%2Btest%40getvero.com after encoding.
  • {{event.invoice_ref | format: '%05d'}} allows you to reformat numerical variables (integers, floats, octal numbers, strings, unsigned decimals and hexadecimals). You can use any formatting from the print format cheat sheet.
  • {{event.price | precision: 2}} allows you to change the precision of integers. As an example, 2.0554 would become 2.06 with a precision of two.
  • {{event.price | delimiter: ',' }} allows you to format numbers so that they include commas. For example, you could do {{ 4000 | delimiter: ',' }} and we’d render 4,000.
  • {{ event.purchase_date | time_zone: 'Sydney' | date: '%d/%m/%Y %H:%M:%S %Z' }} allows you to change the timezone and format of an attribute. The attribute must be a number. You can use any of the timezone values from the TZ column of this guide to timezones. This time formatting tool can help you build the formatting string for output.
  • {{ extra.time.now | date: '%Y' }} gives you the current year. This is commonly used in copyright footers.

Inserting even more powerful data in your emails

There are times when you’ll want to go beyond the data you can push into Vero using our API.

Imagine the scenario where you have triggered a behavioral email three days after a user has taken a specific action, yet want to include the latest products available in your store.

Imagine the scenario you want to send an email every Tuesday and pull in the latest articles from your blog.

Vero’s most powerful dynamic templating functionality is called External Attributes and allows you to pull in data from JSON and HTML API feeds just before an individual email is sent.

This allows you to pull in the most real time data possible. You can learn more by reading our full help article on External Attributes.

Didn't find what you were looking for?

Get in touch, we're always happy to help. Email us at: support@getvero.com

Improve our docs

Our help docs are open to everyone, help us make them better by contributing on Github and you'll be our new best friend!

Search