Forum Discussion
chalkandpixel
2 months agoCollaborator
Using Liquid to identify users in a segment
I'd like to have an element of an email show or hide based on if a user is within a segment using - Is this possible with Liquid? I've been hitting a brick wall with this and any solution i've found ...
jamesyi
2 months agoInfluencer
One way to use liquid for this use case is by using custom attributes filters within the segment. For example, if your segment contains the following filters: age >21, fav_num == 5, and fav_food == burgers, you can use
{% if {{custom_attribute.${age}}} > 21 and {{custom_attribute.${fav_num}}} == 5 and {{custom_attribute.${fav_food}}} == "burgers" %}
show element of email
{% endif %}
However this will only work if your segment contains custom attributes as filters.
See documentation below for supported liquid tags:
Supported personalization tags
If you use other filters (like sessions, demographic, etc), your best bet is using Audience Path and having different versions of email sent to different audiences.
Hope this helps!
Related Content
- 2 years ago