Skip to main content

How to Fix That Embarrassing Email Personalization Mistake

Getting someone’s name wrong makes for a bad impression. That applies to email too, of course. You’ve seen emails that start like this:

Or this:

Imagine this scenario in real life, face-to-face with an acquaintance: “Hey first name, so great to see you!” or “Hi [awkward pause]”. You either look a bit loopy or like you just forgot the name of the human in front of you.

But why does this happen?

When contact information flows in from different sources — like website signups, lead generation forms, and event registrations — messaging tools end up collecting a grab bag of data. And don’t forget, humans aren’t consistent when it comes to data entry, guilty of irregular capitalization, errant spacing, typos, and other mistakes all by themselves.

That’s how you end up with a database of recipients that looks something like this:

Note that:

  • Not every name is capitalized.
  • There are some empty data fields.
  • Bob entered a first and last name together in the same field.
  • Felix has an email but no name data. (This one’s bound to happen when using registration forms with just an email address field.)

Name personalization is a basic part of messaging people—so basic that most email marketers drop in some type of first name content tag without thinking about it. But woe to those who have data issues in their system! This is a super common problem and luckily, there’s a simple solution.

Cover Your Personalization Bases with Fallbacks

The simple fix to avoid making embarrassing personalization mistakes? Have a backup plan!

These days, you can usually insert dynamic content into a message, based on the data you have about your recipients. Usually, such tools will also give you the ability to set a fallback, in case a recipient is missing the data required.

In the case of Felix, here, we’re missing first and last name information. By setting a fallback like “friend” or “there”, Felix will get an email with a nice “Hi friend” or “Hi there” greeting instead of an offputting “Hi [first_name]”.

That’s the simple takeaway: set up a fallback!

Read on to learn how this all works in Customer.io.

How to create Liquid fallbacks in Customer.io

Customer.io uses Liquid, a powerful templating language that makes it easy to personalize content with data. To solve the “Hello [firstname]” issue, you create a fallback in Liquid, which checks to see if the name data exists and replaces the name with alternate text when it’s missing.

But first, let’s review how data is organized in Customer.io.

There are two types of data: customers and events. Customers and events can both have attributes. Customer attributes describe a person or their current state, like a first name, location, subscription plan name, or email address. Event attributes, on the other hand, describe details pertaining to a specific event. For example, a purchase event might have attributes like specific items, purchase price, time of transaction, etc.

When you want to include an attribute to personalize your message, you’ll use a Liquid variable, wrapping the attribute name in double curly brackets like so: {{ data_type.attribute_name }}

To insert the first name of a customer, you’d use something like {{ customer.first_name}}.

What’s special about Customer.io is that if a recipient is missing a certain variable, the send will fail. This way, we save you from embarrassing “Hello [first name]” situations and similar muckups altogether. However, you’d still want to use fallbacks so that you don’t have to spend time troubleshooting and fixing failed sends! Here’s how:

Step 1: Write your rule in plain language

This might seem like a silly step but it’s a good habit to get into, especially for more complex cases. Start by writing out what you want to happen in plain language:

Insert the recipient’s first name. But if we don’t have the recipient’s first name in our database, replace the first name with “there”.

Step 2: Build your Liquid one step at a time

The best way to translate this statement into Liquid is to start by imagining that the database is perfect. In that case, our message starts off like this:

Hi {{ customer.first_name }}

Since no database is perfect, we’re going to create an “if/else” rule that says: if there’s data for the customer’s first name, output that first name.*

Hi {% if customer.first_name %}{{ customer.first_name }}{% endif %}

Now, for the fallback. An “else” statement will determine what to output in case there’s a blank or missing first name:

Hi {% if customer.first_name %}{{ customer.first_name }}
{% else %}there{% endif %},

In plain English, this says that if there’s no first name value, replace the name with the word “there.” Recipients with missing data will see “Hi there” and the email send won’t fail.

Step 3: Refine it (optional!)

One simple way to refine your personalization is to address capitalization inconsistencies in Liquid as opposed to inside your database. To do so, add a capitalization filter:

Hi {% if customer.first_name %}{{ customer.first_name | capitalize }}
{% else %}there{% endif %},

If you know that you have some people with first and last names in the first_name field, you can split the two words and only use the actual first name. In the code below, the split filter is looking for a blank space in the field. When it finds one, it will only include the first word.

Hi {% if customer.first_name %}{{ customer.first_name | capitalize | split: " " | first }}
{% else %}there{% endif %},

Step 4: Preview!

It’s always a smart move to do some quality assurance review before sending any email or setting a campaign live.

Let’s look at the case of Felix again. Remember, we have his email address in the system, but no first name or last name. In Customer.io, you can check the preview specifically for how the email will render for Felix.

Here’s what you see in the Customer.io preview when you’ve inserted the first name Liquid variable with no fallback:

Plus, Customer.io will notify you when there’s an error. If you click on the “Review Error” button, we’ll tell you what data you’re missing for this particular person.

Now, let’s add a fallback, like we did in Step 2. Instead of “there”, I’ll use “burger-lover” as my backup. Here’s what that looks like in the composer preview:

Hooray!

We’ve broken down and refined the details quite a bit here. But you can simply copy and paste the Liquid snippets above into any email!

Final Thoughts on Personalizing with Liquid

  • Double-check where you’ve put spaces and punctuation. This is easy to miss when you’re creating markup in Liquid and dropping in an extra comma or hitting the spacebar outside of the brackets without realizing. If you’re seeing text like “Hi Linda,,” or “Hello ,” in the preview, do a quick check.
  • If your customer database is missing a lot of information, consider running it through the Clearbit Enrichment API to find the missing data.
  • Once you graduate from personalizing first names with Liquid, start exploring the endless ways you can use it to make your personalization awesome. This is where you can really take email and dynamic content to the next level.
  • Don’t be afraid of the Liquid templating language! It can feel a bit intimidating, especially if you’ve never coded before. Customer.io has safeguards like the error detection and preview capability, documentation and tips, and of course, our support team to help!

Finally, remember that true personalization doesn’t come down to whether you’re using a name or not. You could send an email every day using first names perfectly in the greeting and subject line but fail to make any positive impact. The name trick can help a bit, slip-ups with data and dynamic content can hurt a bit—but at the end of the day, personalization has to be meaningful to actually work, coming down to whether your message is relevant or not.

*Note: For Customer.io folks who aren’t yet on our new Google Cloud infrastructure, it’s best to use a slightly different “if” rule than described above. Instead of {% if customer.first_name %}{{ customer.first_name }}, use {% if customer.first_name != blank %}{{ customer.first_name }}.

Have any questions about Liquid or want to share your cool message personalization tactics? Add your comment below!