Skip to main content
Solved

Using personalization tags within event variables - is it possible?


Forum|alt.badge.img+3

I have a metric-triggered flow in which the subject lines are dynamically populated via event variables. So the subject lines are set up as `{{event.subject_line}}`. When I post an event that has something like `subject_line: “Hey, {{first_name}}”` in the event payload, the subject line in the sent email looks exactly like that - it says “Hey, {{first_name}}”, without populating that name. Is there any way to make this work as desired (i.e. the first name set in the profile would actually be inserted)?

Best answer by saulblum

If the event property itself has django variable tagging, e.g. {{ first_name }}, I don’t think you’d be able to have two levels of variable replacement, iu.e. where it first fetches, say, “Hey, {{first_name}}” from the event body, and then replaces {{ first_name }} with the actual profile name.

You’d have to include the already rendered name in the event body. 

View original
Did this topic or the replies in the thread help you find an answer to your question?

7 replies

KeviSunshine
Expert Problem Solver III
Forum|alt.badge.img+8
  • Expert Problem Solver III
  • 158 replies
  • January 26, 2024

Hi @kristinab,

 

Use `person.first_name` for profile properties! You can use profile properties in metric-based flows, but you need to use `person` rather than `event`.

You can use both `event` and `person` within a metric based flow.

 

Cheers,

Kevin.


Forum|alt.badge.img+3
  • Author
  • Contributor III
  • 6 replies
  • January 26, 2024

Thanks for the response Kevin!

Just to make sure I’m being clear, I’m attempting to use `{{first_name}}` as part of the value of the `event.subject_line` key - so there’s a nesting situation here that doesn’t appear to be working properly. I will try `{{person.first_name}}` instead, but I’m not sure that’s going to change anything.


KeviSunshine
Expert Problem Solver III
Forum|alt.badge.img+8
  • Expert Problem Solver III
  • 158 replies
  • January 26, 2024

@kristinab,

I’m so sorry–I totally misread your comment.

I have no idea if this is going to work and my assumption is it will not work. Regardless, I think you would need the `person.` anchor if it does work at all…

 

Let us know what happens!


Forum|alt.badge.img+3
  • Author
  • Contributor III
  • 6 replies
  • January 26, 2024

Thanks again! Will do some testing and see if I can find a way to make it work :) 


Forum|alt.badge.img+3
  • Author
  • Contributor III
  • 6 replies
  • January 26, 2024

In case anyone is curious - I haven’t found a way to make this work (yet).


Omar
Partner - Platinum
Forum|alt.badge.img+46
  • 2025 Champion
  • 494 replies
  • January 27, 2024

@kristinab,

The Klaviyo editor has the option to allow you to select the variable you need for first name.

I would suggest you to use this when adding variables just to be sure.

Now, since not all profiles have their first name populated I suggest to always have fallbacks when you're using variables. Make sure you're using the First name variable you've stored in Klaviyo.

{{ first_name|default:"FALLBACK TEXT HERE" }}

 

 

Omar Lovert // Polaris Growth // Klaviyo Master Platinum Partner

We help with e-commerce growth through CRO, Klaviyo and CVO


Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • Answer
  • January 28, 2024

If the event property itself has django variable tagging, e.g. {{ first_name }}, I don’t think you’d be able to have two levels of variable replacement, iu.e. where it first fetches, say, “Hey, {{first_name}}” from the event body, and then replaces {{ first_name }} with the actual profile name.

You’d have to include the already rendered name in the event body.