Merge Tags (HTML/CSS)
Last updated
Last updated
This article dives deep on the 3 categories of merge tags used within our Poplar platform. If you want to learn how to add merge tags to your creative please check out .
One unique feature of the Poplar platform is the capability to print dynamic mailers. You can personalize your postcards or letters just like you can in an email with any information you have on your customers like first name, past products purchased, and unique promo codes. This personalization allows you to create designs that are statistically more likely to get the recipient’s attention since they’re tailored to each individual.
Poplar offers a variety of flexible and creative ways to customize mailers based on different types of collected audience data.
Translating a static PDF design may sound intimidating, especially if you have little to no prior coding knowledge. Fortunately the process is usually as simple as:
Pulling certain aspects of your static design together
Re-saving them as one element
Embedding the URL within an .html
file.
There are a few key tools and elements to have in place before you begin:
Your original InDesign or Illustrator files
All image assets and fonts
Poplar’s HTML template files ()
A text editor such as or
A tool to preview your design as you code such as a browser window or
Since Poplar is converting an HTML file to PDF, the capabilities and best practices differ slightly from a web page which uses a multitude of behind-the-scenes tools and software to render in a browser.
A browser can be used to preview your code design, but keep in mind certain elements, such as merge tags, may appear differently in the browser than they do when converted to PDF in the platform - this is why viewing the PDF proof generated by the platform is the best, most accurate way to check your work.
Personalizations can be broken down into four merge tag categories: Default, Promotion, Location-based, and Custom - all of which can be dynamically optimized by the use of Shopify’s language.
Default Merge Tags (Recipient)
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 recipient.
merge tags. This means that in the event of a blank value or mismatched data, your creative will print with a blank.
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...
Column Header or Key
Merge Tag
full_name
{{recipient. full_name}}
first_name
{{recipient. first_name}}
last_name
{{recipient. last_name}}
address_1
{{recipient. address_1}}
address_2
{{recipient. address_2}}
city
{{recipient. city}}
state
{{recipient. state}}
postal_code
{{recipient. postal_code}}
{{recipient. email}}
identifier
{{recipient. identifier}}
If you've created a Promotion and uploaded a list of unique codes, use a {{promotion.promo-code}}
merge tag to pull in each code. Upon uploading creative, the platform will detect promotion. and prompt you to select your Promotion from a dropdown.
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.
Saved Location Field
Merge Tag
Location Name
{{location. name}}
Address 1
{{location. address_1}}
Address 2
{{location. address_2}}
City
{{location. city}}
State
{{location. state}} or {{location.state_name}}
Postal Code
{{location. postal_code}}
Merge field 1
{{location. merge_field_1}}
Merge field 2
{{location. merge_field_2}}
Merge field 3
{{location. merge_field_3}}
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:
Column Header or Webhook Field
Merge Tag
image-url
{{custom. image-url}}
last-purchase
{{custom. last-purchase}}
loyalty-level
{{custom. loyalty-level}}
first-name
{{custom. first-name}}
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.
Poplar also has the ability to render QR codes by using a Liquid tag to pass promotional data into the QR code configuration. The Liquid tag will return an image URL which can be used either as the src attribute of an <img>
element or as the url for a background image.
The length of your URL affects the density of the QR code, therefore we recommend generating/using a shortened version of your URL to avoid scanning issues when printed.
Promotional data (codes, urls, etc.) must be created externally, as Poplar does not have the capability to generate or track promotional data.
Background Image Example
Image Source Example
When setting up your QR code, the following parameters can be used in the configuration:
color
optional
The foreground color for the QR code
bg
optional
The background color for the QR code
If the parameters are used as a merge tag, they do not currently have validation. For the color and bg, you will need to add the hex code without the # e.g., FF0000, not #FF0000.
If the text field is empty, there will be no error.
Basic Example
Promotion Example
You can also reference promotion codes you imported into the Poplar platform.
Custom Merge Tag Example
Custom URL/string Example
The QR code image returned is an SVG so that can be displayed at any size.
Objects Add high-level variability to dynamic data in your creative. All default and custom merge tags used in creative are classified as objects.
Filters Allow you to reformat and set consistent formatting ( ie uppercase, lowercase, or proper-case)
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.
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.
Variable Discount
Offer a variable discount based on a customer’s purchase history, average order value, lifetime 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.
Terms & Conditions
Dynamically alter legal text based on the recipient's city
or state
.
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.
Reach out to support@heypoplar.com for more use cases or assistance...
There must be at least one (1) saved location under the geo-locations tab & the saved locations suppression must be toggled on under the campaign Suppressions tab before you upload an HTML creative including {{location.merge_tag}}. Click to learn more.
The platform does not track QR code scans as part of attribution reporting. This is because scans can typically be tracked in the program used to generate your unique QR code URLs, such as
Poplar accepts the use of Shopify's 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:
Tags Let you add conditional logic (using ) to your messages. The most basic form is an if...else
statement.