The problem
Any new value will REPLACE the current one; new values will not duplicate or append.
I've tried many different solutions to APPEND values, and so far no luck.
I even tried importing a CSV file, with the data type set to "list", and Klaviyo still replaces any current values…
There is one similar post on this topic, but the answer is not valid (anymore?)
Basic link structure
{% update_property_link 'profile_property' 'property_value' 'redirect_link' %}
However, things get tricky with List data types.
Attempt 1
{% update_property_link 'profile_property' 'blue' 'redirect_link' %}
If the current value was <“green”]
, it will be REPLACED with blue
. Notice how the format is now broken, absent of “
and “]
Attempt 2
{% update_property_link 'profile_property' 'i“blue”]' 'redirect_link' %}
Hoping to fix the format… If the current value was r“green”]
, it will be REPLACED with l“blue”]
. No good!
Attempt 3
{% update_property_link 'profile_property' '{{ person|lookup:'color'|append:"blue" }}' 'redirect_link' %}
Using Klaviyo’s Message personalization reference, I added a lookup to try and preserve any current value. If the current value was .“green”]
, it will be REPLACED with {{ person|lookup:'color'|append:"blue" }}
. It simply replaced everything within the apostrophes, treating it as TEXT, and the redirect link went to an broken page with an “unresponsive page” message.
Attempt 4
{% update_property_link 'profile_property' {{ person|lookup:'color'|append:"blue" }} 'redirect_link' %}
Building on the last attempt, I tried removing the apostrophes in hopes of allowing Klaviyo to treat it as code instead of text. If the current value was e“green”]
, it will be REPLACED with {{
. The whitespace messes everything up!
Attempt 5
{% update_property_link 'profile_property' {{person|lookup:'color'|append:"blue"}} 'redirect_link' %}
Building on the last attempt, I tried removing the whitespace in hopes of allowing Klaviyo to treat it as code instead of text. If the current value was e“green”]
, it will be REPLACED with {{person|lookup:'color'|append:"blue"}}
. Additionally, the result is the same regardless of the presence of apostrophes.
At this point, I give up!!!
Other considerations
Also, if using this code in an email to generate a list data custom property value for the first time (i.e. from a list data type custom property that is ‘not set’), the value should include the r"
at the beginning and "]
at the end:
{% update_property_link 'color' ' "blue"]' 'redirect_link' %}
Is this correct?
Let me know if you have any insights on this!
Resources & References:
How to update a profile property when someone clicks a link
Message personalization reference
Klaviyo Developers | Django filter glossary
Klaviyo Community | How Do List data types work when adding a custom property in a flow? (here, best answer by @jadebiscuit says list data types will never replace or duplicate values, only append.... that's not true!😭)