Solved

How do I add a comma into a dynamic tag so that it only shows up if that tag exists in someone's profile?

  • 24 October 2021
  • 3 replies
  • 518 views

Badge +1

Hi,

I’m trying to create a subject line that reads “[first name], you’re gonna love this!”. If I use the dynamic property of {{first_name|default:''}}, anyone whose first name isn’t entered into their profile will see the subject line as “, you’re gonna love this!”. A little awkward. Is there any way to make it so that comma and space only show if the first name field populates, and not for the default?

Thanks!

icon

Best answer by Taylor Tarpley 25 October 2021, 17:26

View original

3 replies

Userlevel 7
Badge +59

Hi @lafemmebohemejewelry

 

Happy to share more insight! 

 

Subject lines in emails do support dynamic tags and variables so it is very easy to show certain phrases depending on whether or not specific data is available in Klaviyo. I suggest using the  {{first_name|default:'Friend'}}, instead of it displaying without a name if a first name isn’t available. When no first name field is present, it would display as "Friend, you're gonna love this!" instead of a user’s first name. While you cannot add a comma into the tag, you can use other variables like if/else blocks  to create a certain phrase if certain data is present and another phrase if it isn’t. 

 

For example you could create an if/else block that would display depending on the conditions below. 

{% if person|lookup:'first_name' %}You’re going to love this, {{ first_name }}{% else %}You’re going to love this{% endif %}

 

Hope this provides more clarity to answer your question! 

-Taylor 

 

Badge +1

Thank you Taylor, but that doesn’t really answer my question…

Userlevel 7
Badge +59

Hi @lafemmebohemejewelry

 

Welcome to the Community! Love that you’re brining some personalization to your emails, it goes a long way to make your customers’ feel special! 

 

I agree that could be a bit awkward if their first name isn’t stored in your account, I would suggest inserting a Default Filter to populate for the tag if that information isn’t available. For example, you could add ‘Hey’ to the Default Filter to make it feel more warm and look grammatically correct for your specific campaign subject line. On the other hand, you could first add ‘Hi’ before the tag is inserted just as the example for an additional option. 

 

 

Additionally, I’d check out this Community Post to gain further insight into how Default Filters work! 

 

Thanks for sharing your question in the Community! 

-Taylor 

Reply