Solved

Update profile property with event variable

  • 13 July 2021
  • 2 replies
  • 155 views

Badge

Before posting this question, I found this post 

I think my use case is very similar if not the same. I am tracking a “profile activity” with a “metric/event” named “Subscribed to List Key”. This “metric/event” contains one property named “list_key”.

I create a flow which is fired off from the “metric/event” mentioned above. Then I have a “Update Profile Property” action. I am trying to update a profile property called “subscriptions” (array of strings) by appending the list_key to it.

However, I try to reference the event variable {{ event.list_key }} and it’s just not working. Based on the post I found and that I am referencing in this post, I believe it’s not possible to do this. However, is this something that will be supported in the future?

icon

Best answer by retention 13 July 2021, 20:32

View original

2 replies

Userlevel 7
Badge +5

Hi @angel.mendoza@daveramsey.com, welcome to the community!

Since you referenced a post that I answered in, thought I’d chime in.  As far as I know, you’re right and you can’t use a dynamic value from the event (e.g. event.list_key) as a value to update a property in the “Update Profile Property” action of a Flow.  Currently, it seems the property value can only be a hard-coded literal.

However - assuming you are sending events via the Javascript Client Library, one possible work around for you is to follow up with your Track Event to use the Identify API, given that you have access to the email address (or ID) at the time of the event, to pass in the properties you want to append to that profile’s custom property (e.g. list_key) at the same time you pass in the Event/Metric. 

See the example in the API Docs:

<script>
var _learnq = _learnq || [];

// Identifying a person and tracking special Klaviyo properties.
_learnq.push(['identify', {
'$email' : 'thomas.jefferson@example.com',
'$first_name' : 'Thomas',
'$last_name' : 'Jefferson'
}]);

// Adding custom properties. Note that Klaviyo understands different data types.
_learnq.push(['identify', {
'Plan' : 'Free Trial',
'SignUpDate' : '2016-01-27 12:10:05',
'HasFilledOutProfile' : false
}]);
</script>

In this example, they are also adding custom properties like “Plan, SignUpDate, and HasFilledOutProfile” with their respective values.  

 

If you are sending “Track Events” via the Server Side Library, then you can just add those properties along with the Server Side track event.
See this example: 

{
"token": "PUBLIC_KEY",
"event": "Ordered Product",
"customer_properties": {
"$email": "bob@klaviyo.com",
"pet-type":"Dog"
},
"properties": {
"item_name": "Dog Collar",
"$value": 15
}

In this example, they are adding a custom profile property “pet-type” with the value “Dog” to be part of the Profile at the time of the event/metric being passed in.

Hope this helps!

Badge

@retention - Thanks for your prompt response

Using the APIs is what I am trying to avoid. I want to transfer the responsibility of managing “profile properties” to my Marketing Team. Basically, I use the API to publish events with properties and they take it from there.

It feels “natural” or “intuitive” to allow for a “profile property update” based on the value of an event variable/property

Reply