Solved

Using personalization tags within event variables - is it possible?

  • 26 January 2024
  • 7 replies
  • 82 views

Badge +2

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)?

icon

Best answer by saulblum 28 January 2024, 20:40

View original

7 replies

Userlevel 4
Badge +7

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.

Badge +2

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.

Userlevel 4
Badge +7

@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!

Badge +2

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

Badge +2

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

Userlevel 7
Badge +44

@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

Userlevel 4
Badge +7

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. 

Reply