Get In Touch
Pardot Development

How to Use Pardot Conditional HML

There’s little dispute about the value of personalized emails. Personalized emails perform better than generic ones overall, but critically, email recipients have also developed a distaste for emails that lack personalization (or have been personalized poorly); Adobe has found that 42% of recipients are annoyed by content that isn’t personalized.

Pardot offers additional email personalization options beyond HML (Handlebars Merge Language)—like dynamic content or using things like scoring categories or well-refined lists for better targeting—but HML is where most Pardot users start their personalization journey.

What is Pardot Handlebars Merge Language (HML)

Pardot Handlebars Merge Language (HML) has been turned on by default for all new Pardot accounts since June 2020. If your account is still using Pardot Merge Language (PML), the remainder of this article will be irrelevant until you make the switch.

Need help switching from PML to HML, and/or updating your legacy assets to HML? Reach out and let us know.

In short, Handlebars Merge Language (HML) makes it easy to dynamically insert data into email content, including subject lines. Handlebars merge fields include account information, user information, data from prospect records, and a few others.

See the table below for a few examples.

Handlebars Merge FieldData the Field DisplaysExample
{{Recipient.FirstName}}Prospect’s First Name fieldJessica
{{Recipient.State}}Prospect’s State fieldTexas
{{Current_Year}}The year the email is sent formatted as YYYY2022
{{Sender.Title}}The sending user’s job titleConsultant
There are currently 74 total options, so get familiar with them!

When do we need Pardot Handlebars Merge Language (HML) to be conditional?

If you’re sending an email to a large group of prospects, chances are the data is inconsistent across all recipients, potential senders (especially if sending from an assigned user), and accounts. If some of your prospects, users, or accounts are missing field data (and you’re referencing those fields through HML), your email is going feel pretty clumsy to its recipient.

Review the two email examples below. Both outcomes are from the same email, formatted correctly with conditional HML. In the first example, the previewed prospect has a first name, a city listed on their prospect record, and an assigned user (and that user has their own signature and phone number). Depending on whether or not the values are present on the relevant records, the way the data displays changes.

How was it formatted in Pardot to behave in this way? See our code sample below.

Pardot Conditional Handlebars Merge Language (HML) Email Example

Hi {{#if Recipient.FirstName}}{{Recipient.FirstName}}{{else}}there{{/if}},

​​​​​Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

We have exciting news for our clients{{#if Recipient.City}} in {{Recipient.City}}{{else}}{{/if}}.

You can reach us at <<{{#if Recipient.Owner.Phone}}{{Recipient.Owner.Phone}}{{else}}(123) 456-7891{{/if}}>>.

Let's chat soon!

{{#if Recipient.Owner.Name}}{{Recipient.Owner.Name}}{{else}}Parquet Development{{/if}}
{{#if Recipient.Owner.Name}}{{Recipient.Owner.Phone}}{{else}}(123) 456-7891{{/if}}
{{#if Recipient.Owner.Name}}{{Recipient.Owner.Email}}{{else}}hello@parquet.dev{{/if}}

How to Write Pardot Conditional Handlebars Merge Language (HML) Yourself

As you can probably gather by inspecting the email above, conditional statements are built by creating one-to-one replacements for empty field values (though they can’t evaluate the fields for the data they do contain). The logic is pretty simple—format your merge fields like this.

{{#if field.name}} {{else}} {{/if}}

If we’re using the prospect first name field, it might look like this (insert whatever you like in place of “Customer”).

{#if Recipient.FirstName}}{{Recipient.FirstName}}{{else}}Customer{{/if}}

Conditional Handlebars Merge Language (HML) Testing

Testing is critical with conditional HML. To test properly, we suggest:

  • Find an existing prospect that has data for all the fields you expect to populate (and note their email address)
  • Find an existing prospect with no data in those same fields (or create a new test prospect)
  • Open up the “Preview” tab in your email builder and enter each of those prospects’ email addresses to see how it would render in each case
  • Solve any issues that arrive, whether that’s at the email level (correcting your conditional merge language), or at the record level (if some of your users are missing signatures or phone numbers, for example).

Need help re-writing your existing email templates to include conditional HML? Reach out and let us know.


Jessica Hope

I consider myself a Marketing Cloud Account Engagement (Pardot) evangelist. I’ve focused almost exclusively on Pardot for the last seven years, and I've had the great honor of working in hundreds of accounts on every imaginable type of project. I spend most of my time working directly with clients to meet their every last Pardot goal, but I also enjoy writing about and/or training on all things Pardot.

Let’s connect to see where I can help. Email me at: jess@parquet.dev

Leave a Reply

Your email address will not be published.

Privacy Settings
We use cookies to enhance your experience while using our website. If you are using our Services via a browser you can restrict, block or remove cookies through your web browser settings. We also use content and scripts from third parties that may use tracking technologies. You can selectively provide your consent below to allow such third party embeds. For complete information about the cookies we use, data we collect and how we process them, please check our Privacy Policy
Youtube
Consent to display content from Youtube
Vimeo
Consent to display content from Vimeo
Google Maps
Consent to display content from Google
Spotify
Consent to display content from Spotify
Sound Cloud
Consent to display content from Sound
Parquet Dev Salesforce consultants favicon