Solved

Using The First Name Code

  • 11 December 2020
  • 9 replies
  • 31441 views

Badge +2

Hi everyone,

 

I’ve been having a problem using the code to insert the customer’s first name into my emails. It seems like it works some of the time, and other emails I end up seeing just have a blank space. I sent out a holiday sale email this morning, and when I saw my copy, I realized it was just a blank space where the first name should be. This is very disappointing, embarrassing, and makes my emails look unprofessional because there is a comma, a space, and then an exclamation mark rather than a name inserted. Does anyone know how to ensure that the first name is always going to appear properly?

 

Thank you,

Meryl

icon

Best answer by retention 11 December 2020, 16:35

View original

9 replies

Userlevel 7
Badge +58

@greenpandamindbodyHi there.

I assume you’ve used this code to dynamically populate the First Name: {{ first_name|default:'' }}

In order for Klaviyo to display the first name of your subscriber in the email, you must have that information for your subscriber.

Usually, many brands have subscribers with the first name information and subscribers for which they only have their email address. I assume this is your case too.

Subscribers that you have in your account that have the first name information are usually customers who came into Klaviyo by purchasing something in your store. When they purchase something, they’re required to fill the checkout form and this is where they give you their first name. These are the subscribers for which the code {{ first_name|default:'' }} will successfully display their first name.

On the other hand, if the subscriber comes through a form (pop-up for example) that only requires him to enter his email address, you haven’t captured his first name. If you don’t have the first name of your subscriber, Klaviyo can’t know what to put there.

This is why the code {{ first_name|default:'' }} contains the |default:'' part.
Between the brackets in that part, you can put something generic that will be used for subscribers without the first name information.

Example:
Hi {{ first_name|default:'there' }}!

For subscriber (E.g. John) that you have the first name information it will display:
Hi John!

For subscriber that you don’t have the first name information it will display:
Hi there!

Hope this clarifies how this works.

 

---

Joseph Hsieh // retentioncommerce.com // twitter: @retenion 

Badge +2

This helped a lot, thank you!

Userlevel 4
Badge +7

How can you add the customers first name into subject line and ensure that the first letter is in caps as often customers add their first name in lower case by mistake?

I can’t seem to find this too. What’s the first name merge tag that capitalises the first letter of a name?

Badge +1

How can you add the customers first name into subject line and ensure that the first letter is in caps as often customers add their first name in lower case by mistake?

You’re looking for {{ first_name|capfirst }}

See: https://developers.klaviyo.com/en/docs/glossary_of_variable_filters

Awesome, thanks!

Hi! what merge code tag do I use if I want the first name to display in caps?

Hey @ashae you can use: 
For above title case Q you can also use, ‘Title case’ - {{ first_name|title|default:"" }}
For UPPERCASE you can use, ‘upper’:  {{ first_name|upper|default:"" }}
If you are looking for lower case simply use: ‘lower’:  {{ first_name|lower|default:"" }}

Userlevel 7
Badge +58

In a recent update to the Template Editor, it is now easier then ever to add personalization tags like “First Name” with a default value.  If you click on the “Add Personalization” button in the lower right of the text editor, it will prompt you with the default value. 

See here:

I used the default as “friend” and when you click “Insert” you should see the code as follows:

{{ first_name|default:'friend' }}

 

Reply