Merge Tags

Utilize HTML Merge Tags to pull variable audience data into creative designs and beyond.

Poplar offers a variety of flexible and creative ways to customize mailers based on multiple types of collected Audience data. These personalizations can be broken down into three merge tag categories: Default, Location Based, and Custom - all of which can be dynamically optimized by the use of Shopify’s Liquid Template language. All merge tag names must be formatted to exactly match the corresponding column header in your Mail File or Mailing API request.

Default Merge Tags

Poplar will automatically populate default merge tags based on recipient data received via CSV upload or trigger integration. In your HTML creative, default merge tags are always preceded by recipient. to access the core recipient data in your mail file or API request.

The platform will NOT prompt you to set default values for default merge tags. This means that in the event of a blank value or mismatched data, your creative will print with a blank. Double check all column headers and Test all triggers before launch to ensure there are no merge tag data discrepancies.

Missing first name data will populate as Current Resident and will appear on your creative as such - if you are using the {{recipient.first_name}} merge tag, make sure first name is provided for every recipient. See the Custom Merge Tag section for details on how to use first name with a default value...

Location Based Merge Tags

Location based merge tags populate with data pulled from Saved Locations within your Poplar account. They are considered default merge tags, meaning the platform will NOT prompt you to set a default value to appear in the event of missing data. Location based merge tags provide a flexible and easy way to customize creative based on Geolocation settings.

Custom Merge Tags

Poplar populates custom merge tag data by pulling from any additional column headers in your CSV Mail File, or any values present in the merge_tags object of your triggered API request. When HTML creative files are uploaded, the platform will scan for any custom merge tags present in your design and prompt you to set a default value. The default value will populate the custom merge tag in the event of a blank field or mismatched data in your CSV mail file or API request.

Uploading and storing files under Audiences will strip all custom merge tag values and extra column headers. To preserve custom merge tags for a One Time Send, drag & drop your CSV file directly into the platform during the launch process.

When adding custom merge tags to you HTML, make sure they are always preceded by custom. This is how the platform differentiates between default and custom merge tags. The following are common examples of custom merge tags:

If you don't have first name data for every recipient, you can create an additional custom merge tag named anything BUT first_name (ie. first-name or firstname). The platform will prompt you to set a default value (ie. "there" or "friend") to appear in the event of missing data.

Liquid Templates

Poplar accepts the use of Shopify's Liquid Template language in HTML creatives. Liquid is an open-source templating language that lets you add nifty logic to dynamic data to make it even more flexible by using:

Objects Add high-level variability to dynamic data in your creative. All default and custom merge tags used in creative are classified as objects.

Tags Let you add conditional logic (using operators) to your messages. The most basic form is an if...else statement.

Filters Allow you to reformat and set consistent formatting (ie uppercase, lowercase, or proper-case) merge tag values.

Examples & Use Cases

There's no limit on the number of ways you can get creative with Liquid Templates; below are some sample use cases and code snippets to get you started. We highly recommend testing all your Liquid templates thoroughly in order to ensure they are error free!

Rolling Expiration Date

Add an expiration date to your creative that will always show 90 days from the time of print. The Liquid filter below creates a Unix timestamp, adds the number of seconds in 90 days and then reformats the date. See more date formats...

<!-- Example -->
If the postcard is printed on January 1, 2020 the output will automatically
calculate and show 90 days in the future. 

<!-- Code -->
<div class="terms">
<p>
Offer valid before {{ "now" | date: "%s" | plus: 7776000 | date: "%b %e, %Y" }}.
Visit heypoplar.com/legal for additional terms.
</p>
</div>

<!-- Output -->
Offer valid before Mar 31, 2020.
Visit heypoplar.com/legal for additional terms.

Consistent Character Casing

If your audience data contains some values that appear in all caps, lowercase, or a mix of both, Liquid can be used to ensure they appear consistently formatted in your creative design. Below is an example for how to make sure all first_name data appears in proper case, with the first letter uppercase and the rest lowercase.

<!-- Example -->
If audience data contains first_name "jane" or "JANE" you want to make sure it
always appears as "Jane"

<!-- Code -->
<div class="dynamic-greeting">
<p>
Hey {{ recipient.first_name | capitalize }}!
Check out our new summer styles...
</p>
</div>

<!-- Output -->
Hey Jane!
Check out our new summer styles...

Variable Discount

Offer a variable discount based on a customer’s purchase history, average order value, loan-to-value, etc. The Liquid tag below will use a custom merge tag to display a different message based on the purchase_history value listed in your audience data.

<!-- Example -->
A value greater than or equal to $200 for purchase_history would should read: 
"In celebration of your birthday, please take 20% off your next purchase..."

A value below $200 should read:
"In celebration of your special day, take $10 off your next purchase..."

<!-- Code -->
<div class="offer">
<h1>We want to say thank you for your loyalty -</h1>
<p>
{% if custom.purchase_history >= "200.00" %}
    Enjoy 20% off your next purchase!
{% else %}
    Here's $10 off your next purchase of $100 or more! 
{% endif %}
</p>
</div>

<!-- Output for purchase_history >= $200 -->
We want to say thank you for your loyalty -
Enjoy 20% off your next purchase!

<!-- Output for purchase_history < $200 -->
We want to say thank you for your loyalty -
Here's $10 off your next purchase of $100 or more!

Terms & Conditions

Dynamically alter legal text based on the recipient's city or state.

<!-- Example -->
Adjusting the legal text only on mailers sent to California to be CCPA
compliant

<!-- Code -->
<div class="legal">
<p>
Offer valid for first purchase.
{% if recipient.state == “CA” or recipient.state == "California" %}
    Under the California Consumer Privacy Act (CCPA)...
{% else %}
    Read our privacy policy at heypoplar.com/legal.
{% endif %}
</p>
</div>

<!-- Output for California residents -->
Offer valid for first purchase. Under the California Consumer Privacy Act (CCPA)...

<!-- Output for everywhere else -->
Offer valid for first purchase. Read our privacy policy at heypoplar.com/legal.

Behavior Dependent Images

Show a different product image based on characteristics related to the recipient’s most frequently purchased item. Below we have a custom merge tag called item-color, and the image shown in the creative features items of a similar color to those most frequently purchased.

<!-- Example -->
If a customer frequently buys red sunglasses, we want to show an image containing
mostly red sunglasses.

If a customer frequently buys blue sunglasses, we want to show an image containing
mostly blue sunglasses

<!-- Code -->
<img 
  {% if custom.item-color == "red" %}
    src="https://amazons3.com/my_images/red_sunglasses.png"
  {% elsif custom.item-color == "blue" %}
    src="https://amazons3.com/my_images/blue_sunglasses.png"
  {% else %}
    src="https://amazons3.com/my_images/mixed_sunglasses.png"
  {% endif %} 
>

<!-- Output for Red -->
<img src="https://amazons3.com/my_images/red_sunglasses.png" class="dynamic-img">

<!-- Output for Blue -->
<img src="https://amazons3.com/my_images/blue_sunglasses.png" class="dynamic-img">

<!-- Output for N/A -->
<img src="https://amazons3.com/my_images/mixed_sunglasses.png" class="dynamic-img">

Reach out to support@heypoplar.com for more use cases or assistance...

Last updated