Personalization Variables - possible to create conditions or multiple fallbacks?

  • 20 June 2021
  • 4 replies

Userlevel 4
Badge +9

Hi folks, 

I’m not sure the best way to describe this, but is it possible to create something like multiple Personalization variables/fallbacks?

For example:

I’m working with a list where most subscribers have supplied their first and last name, but some have left the field blank, and in some cases, instead of a name, there are multiple instances of the fields having “bc”.

Is it possible to do something like the below, but have the “first name” revert to the default value if another specified value is found, not just when the first name value is missing?

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

Sort of like: “Hi {{first_name | if: blank, if:”bc” | default: “there”}}

This probably isn’t possible, maybe I’ve spent too much time in excel, but it would be awesome if possible!




Best answer by julie.accardo 20 June 2021, 15:49

View original

4 replies

Userlevel 5
Badge +34

Hi @wernstrom,


Thanks for writing into the Klaviyo Community!


I just tested the following conditional statement in my test account and was able to successfully render “Hi there,” for users with the first name bc. For all other users, I was able to render “Hi {{first name}},”. You don't need to use a lookup since it's a Klaviyo default property.  You can just use person.first_name.

Hi {% if person.first_name = "bc" %}there,{% elif person.first_name %}{{ first_name }},{% else %}there{% endif %}


You can also refer to the Django filters here: 



Hope this helps!


Userlevel 4
Badge +9

Hi Julie, 

Thanks so much for that! I had no idea. I have a bit of a hard time understanding this stuff, but from what I can tell from the Django document, the “% else %” part of that text will also result in “there” being used if the name field is blank?

Thanks again!

Userlevel 7
Badge +60

Hey @wernstrom,

If you were talking about the if statement mentioned by @julie.accardo, the {% else %}there would indeed be your fallback text that would display as “there” when no first name field is present.


Userlevel 4
Badge +9

Great, thank you so much and @julie.accardo, this is awesome!