Skip to main content

Email Personalization 101: Liquid, Smart Fields and more

A thorough overview of using NationBuilder tools to send 1:1-style emails at scale. 

Email Personalization 101: Liquid, Smart Fields and more

See also a recording of our webinar on this topic.

  1. Introduction
  2. Using smart fields to send 1:1 style emails at scale
  3. Taking personalization to the next level with liquid
  4. Liquid for displaying fields (Objects)
  5. Liquid Conditionals (Tags)
  6. Examples of Liquid Conditionals
  7. Source Code Examples:
  8. Related Posts & Resources

 

Introduction

Personalization is a tactic that continues to present a challenge for many organizations. Your supporter community is smarter than they have ever been, and they expect a personalized experience from the websites they visit to the emails they receive. 

To keep their attention, build relationships and drive people to action, everything must feel tailored and uniquely designed for your supporters. The more personalized their experience, the happier and more likely they are to engage with your calls to action.

Infosys research has consistently proven that there is a desire from people for better personalisation, with 31% of people surveyed saying that they would like to see their online experience “far more personalised than it currently is.” In addition to that, 59% of people “who have experienced personalization believe it has a noticeable influence on their site engagement.” 

Reflecting back to your community what they have done to support your organization and what you need them to do next is an important part of increasing trust between them and your mission. 

And furthermore, if you want to have people advocate on your behalf, you need to make it as easy for them as possible. Using tools that allow you to make dynamic asks based on historic engagement is not just a nice-to-have, but a necessity for staying at the forefront of advocate engagement. So let’s dive in to the NationBuilder tools and tactics can set you on your way to doing all of the aboveranging from relatively basic tactics to others that are more complex and powerful. 

Using smart fields to send 1:1 style emails at scale

When talking about personalization in emails, the first place to start is with smart fields. Smart fields allow you to  display dynamic information to recipients in emails. For example, if you’d like to display the ‘last donation amount’ to your recipients, you can use the relevant smart field for that. 

This is one of the great advantages of having an integrated database and email system since the information is living right there and will update dynamicallyso if the recipient donates two minutes before you send the email, it will send the most up to date data without you needing to take any further action.

There are over forty smart fields, find more information on those here.

Below are a few examples of emails using smart fields, one for donations and one for recruiters:

Donor Email Example

Recruiter Email Example

 

Taking personalization to the next level with liquid

Smart fields are a great entry point for personalising emails, but in order to go the extra mile you will want to use something called liquid. NationBuilder uses the open source liquid template programmatic language to access objects and criteria from within your database. This can be used to display dynamic, customised content on a website or within emails. It is hugely powerful and one of the great benefits of using a fully integrated platform such as NationBuilder. 

You might be thinking: “displaying dynamic contenthow is that different to smart fields?” The answer is: it isn’t. In fact, smart fields are actually built on liquid. They’re just made to be a bit more user friendly, but effectively they’re the same thing and you can use either smart fields or liquid to display fields. 

For example, if you look at the screenshot below, on the right hand side you can see the smart field for the first name/friend (in red) followed by the liquid for the exact same (in orange) and then the same again for the email address. 

Smart fields are easier to use (don’t require you to type out the code) however liquid allows you to do lots more. The smart fields chosen are the most used strings of code, but there is a much longer list of values that you can display using liquid.

Liquid for displaying fields (objects)

Below are some examples of what fields you can display using liquid and should be helpful for getting you started and for inspirationnote that this is not an exhaustive list.ur full documentation is available on liquid objects here and liquid template examples here. 

Top Tip: Copy and paste the text from this document into the source code (<> button) of any email blast in your nation order to get the following examples pre loaded in an email draft. 

Demographic Data

AGE: {{ recipient.age}}

LANGUAGE: {{ recipient.language}}

Donation Data*

AVERAGE DONATION AMOUNT: {{ recipient.donations_amount_average_format }}

Social Media Data

TWITTER HANDLE: {{ recipient.twitter_login }}

LINKEDIN PROFILE: {{ recipient.linkedin_profile_url }}

Address Data

BILLING ADDRESS FULL: {{recipient.billing_address.one_line}}

MAILING ADDRESS STATE: {{recipient.mailing_address.city}}

WORK ADDRESS ZIP: {{recipient.work_address.zip}}

Electoral Geography Data**

CONSTITUENCY (UK): {{recipient.federal_district}}

STATE UPPER DISTRICT (USA): {{recipient.state_upper_district}}

Relational Data

RECRUITER NAME: {{ recipient.recruiter.first_name }} {{ recipient.recruiter.last_name }}

FOLLOWERS COUNT: {{ recipient.followers_count }}

Custom Fields

T Shirt Size: {{ recipient.custom_values_for_display['t_shirt_size'] }}

(where ‘t_shirt_size’  is the custom field slug)

A few helpful pointers to note about the above:

Liquid for displaying fields in subject lines and preview text

It is also possible to use liquid to display text in your subject line and/or preview text. 

The most common use case for this is using a first name in a subject line which can really help to make your emails stand out in a crowded inbox, help supporters feel valued, and have a really good impact on email engagement. In the screenshot below, which is an email encouraging people to recruit friends and family, I’m using {{recipient.first_name_or_friend}}, followed by a question (do you know anyone who can help?) and then in the preview text I’m using the liquid for the recruiter count {{recipient.recruits_count}} to further personalise the email to make it seem more considerate and encourage action. 

And then when I send my self the preview email, it looks like this:

Customise your default salutation

You can also tinker with some of your liquid code to make changes to the defaults. For example, when we have the ‘first name or friend’ option in a smart field it is set up to say ‘first name’ as long as that field is populated, but if it’s empty it will default to ‘friend’, e.g. “Hi Friend.”

If you wanted to change that to something else (e.g. supporter or comrade) or another language etc, then you can do that using the following (where I have changed the default to the word ‘supporter.’

{{ recipient.first_name | default:'Supporter' }}

And this is what it looks like in an email (preview on the left, editor on the right):

This can be useful whenever the output might be blank for some users, for example if you want to show supporters their address data and rather than it just being blank you say something like (“no address data in database”) in the case of an empty field.

Liquid Conditionals (Liquid Tags)

You can get a whole load more value from liquid when you start to use liquid logic and liquid conditionals. This is where it will effectively ask a question before displaying relevant data.

So you can build in your email to say if certain criteria is met (e.g. has a tag, a field = x, # of donations >y, recruit count < Z), then display A or if not, display B. And the content (i.e. ‘A’ or ‘B’)  can be paragraphs, photos, buttons, tables, links or a combination of the above.

In this example below looking at the right hand side (the editor) I’m going to use an If/Else variable (or ‘if loop’ as some may know it). And I’m going to use ‘tags’ as the criteria to query. So put simply, if the recipient has the tag “RSVP: London Launch: Jan 2020” they will get the first bit of the email and if they haven’t then they will not. In the screenshot you can see on the right (in the editor) the ‘liquid’ I’ve used in the blue text.

So there is an intro that will go to everyone (We hope you are well.), an ‘if this’ then displays this text bit (with the red button call to action), an ‘else’ I.e. if they don’t meet that criteria - display this text (with the green button call to action), an ‘endif’ which closes the conditional logic and then a sign off ‘thank you,’ which will go to everyone. 

As you can see, in the preview on left the ‘recipient’ (which in the email editor viewer is always  the person you are logged in as), does not have the relevant tag so will get the %else% logic (as you can see in the preview on the left with the green button) but if I was to go in and attribute that tag to the record I’m logged in as and click save, it would display the other text with the red button.

One thing that’s important to call out is that unlike with the liquid displaying in the previous example, there is now just one bracket + a ‘%’ for the conditional logic. E.g. {% logic %}

Examples of Liquid Conditionals

For all the examples below, you can click here to access the source code (<> button) and add it into your own email editor. From here you can copy/paste modify the logic in order to use it for your own purposes.

      • Tags, example 1 (basic)

If you are familiar with NationBuilder you will be familiar with tags. They are the virtual yellow sticky notes you can see in people records that can be easily added/removed one by one, in batch using lists, via imports, page actions or via saved filters. Because of their versatility they are incredibly helpful when it comes to using them for targeting supporters and personalisation. 

In this example below, the logic is: ‘if has this tag,’ then ‘elsif’ this tag and then else for none of the above. The logic will work chronologically, so it will first look to see if anyone has the first tag i’ve asked about, then it will look to see if it has the second tag and if it has neither it will go to the else. If it has both the first and the second it will return the content for the first as the logic works chronologically so you can effectively create a hierarchy if need be.

In this instance the record I’m signed in as has the second tag but not the first, so it’s returning in the second condition the ‘elsif’.

Tags can be used for many things - like RSVPs or attendees to events, or different types of volunteers. In this example I'm looking at tags based on issues people care about and I’ve displayed a different image that will be relevant to their issue. For those I don’t have that data on, I’m displaying the organisation logo.

      • Tags, example 2 (using smart fields)

Given tags’ versatility of tags they  can be really useful for items that don’t have liquid lookups or where you don’t know the code. In this example I’m going to do it on language which doesn’t have a liquid lookup in NationBuilder (see full documentation here).

The process I took here was I created a filter on Language = English, saved that filter and created an auto tag “Language: English” to be appended and dynamically checked every 24 hours. I then did the same with French. 

Now that I have my two language tags, I can create an ‘if loop’ to say ‘if’ the language is English - give me English text, if it is French - give me French text and if neither (i.e. not known) then give text saying  ‘we don’t have your preferred language saved’. In the example below, the record I’m logged in as has neither of the tags so it would receive the ‘else’ content.

Using auto tags can also be helpful if for example you’re unsure of how to use liquid for other things or you want to create rules for different categories that use multiple levels of filter criteria which can be very difficult to build out with liquid. For example, high value donor target, medium value donor target, etc.

      • Tags, example 3 (using ‘or’ logic within your ‘if loop’)

Sometimes you might want to group various tags together when segmenting your emails. This is possible to do by broadening out your liquid code to say ‘if your tags is X OR Y ‘then this, else this. For example below I attended either the conference in 2019 or 2020. 

As well as being able to use OR you can also replace that with AND and that’s not just limited to using tags but can also be used with other liquid conditions. 

      • Volunteer

The next example is for volunteers. Here I’ve got slightly different calls to action and buttons depending on whether the person is marked as a volunteer.

Note how I’ve put the tag immediately in front of the text here to save myself a bit of space and make it more readable. It’s also worth noting that if you do this the text reads from immediately after the bracket closing, so to avoid having a blank space at the beginning of the content you’ll want it to go straight in. 

      • Donor (Example 1)

When it comes to donations and finances, this is where you can really get a lot of value by segmenting your asks to different levels of donors. 

First off is a relatively basic example of a donor vs non-donor. Part 1 is asking if they can donate their average donation amount (as mentioned above) and the other has a general ask to donate. You could also have these pages link to different donation pages or use different parameters that pre-fill a different donation amount when they go through.

 

      • Donor (Example 2)

For a slightly more complex example, here I’m trying to break down the ask depending on the amount of times people have donated to try and drive them towards becoming a recurring donor. 

Option 1 is if they are a recurring donor asking them to fundraise (with a recruiter link).  Since I have that first that effectively means I won’t run the danger of asking any recurring donors to become recurring donors. You’ll notice I’ve actually used a tag for this one, again linked to a saved filter for recurring donor status = active.

Then, I’ve asked anyone who has donated three or more times (but by the logic is not a recurring donor) if they could become a recurring donor. Then I’m reaching out to anyone who has donated once, with a personalised ask acknowledging their donations in the past (with their average donation amount) and then to all others (i.e.non-donors) with a call to action to become a first time donor. In the following example, I’ve fallen into the category of someone whose donated three or more times, but is not a recurring donor.

Again, you might want to be more granular here and take other things into consideration like date of most recent donation or break up their maximum donation amount, but this is an example of what can be done. 

      • Gender

Personalising on gender can be useful, especially if you’re sending emails in languages with different gendered salutation. In this version I’ve done it in English as if you’re writing a formal letter so these apply to Dear Mr, Mrs, First name, etc. 

      • Address (example 1)

Personalising based on address can be very helpful. This basic example shows all people whose address is California and asks them to support a specific proposition. And for anyone who isn’t a California resident, the ask defaults to  reaching out to their friends who live in the state on that issue.

      • Address (example 2)

Another good example I’ve seen used well is querying if an address exists at all. This can be especially helpful if you have a process whereby collecting address data is useful (e.g. for mailing out membership cards). 

This example displays the address on file for those who have it, and for others prompts them to fill it. This could be a good and relatively easy thing to add at the end of a newsletter for example.

And there’s a whole lot further you can do with addresses, including when you bring in electoral districts. So for example I’ve seen customers have detailed emails with different asks depending on the constituency or district they live in and the political affiliation of their representatives, with personalised calls to action. Whilst this can be time consuming to build first time round, it can often be reusable again and again with just some small changes which can be so invaluable for using at scale.

      • Custom Fields

Just as you can display custom fields in emails, you can also query them in liquid logic. 

Again this example is for something like t-shirt size, stating what the records state if it is on file and if it doesn't exist then letting them know and prompting an update.

If the custom field is numeric you can also do greater than or less than in a similar way to what we saw with donation count in the earlier example.

      • Nesting your liquid logic

If you have complex conditions you want to query, then it is possible to nest your logic. So for example, if you wanted to query volunteers vs non volunteers and language: English vs non language English, then that is possible to do as you can see in the below example which has been colour coded to show which logic is related to each other. In that example I am a non volunteer and do not have the tag “Language: English”, and so “International Non-Volunteer” is returned.

Testing your emails

The most important thing to do when personalising and using liquid is to make sure it’s appropriately tested before unleashing it into the world. Here are a few tips to consider:

      • Remember, the preview will always show relevant data for whoever is logged in. To change what a person would see, change the details in the record you’re logged in as (add a donation, delete a tag, etc)
      • You can also test using the test email, send to a few colleagues, and test accounts with different values in their records.
      • Always think about the hierarchy of the logic you build. Make sure you have put in checks to ensure that every ask is relevant to the person in that condition. 
      • Consider when people might have empty fields, and ensure you have relevant language or defaults set up so the email will make sense for them.
      • When copying and pasting, be aware of <span> parameters occurring in the liquid source code and breaking it up. You’ll be able to identify these by accessing the source code (the <> button in your editor) and checking to see if strange characters have occurred.
      • If you’re getting errors you can always copy and paste your liquid code directly into the spam parameters.
      • Formatting (italics, boldening, underlining) of your liquid can lead to errors
      • When copying and pasting, you can also get extra inverted quote marks appearing.

Overall, when something is not looking like it should,  check in the Source Code and you should be able to identify it. 

Happy Personalising!

In the above I’ve shared some strategic and technical examples of what’s possible  with NationBuilder tools such as Smart Fields and Liquid to personalise your emails and encourage your supporters to take action. This is  really just the tip of the iceberg and it can be very powerful when done at scale. 

If you have interesting examples of liquid use in your emails that you’d like to share with the world, we’d love to see them. Just email me at [email protected].

Source code examples

To load all the examples used above into an email blast in your own nation, just click on the below link, and copy  and paste it into the source code (<> button) in your email blast:

Related Posts & Resources:

 

Share this story

Try NationBuilder for free