How do User Tags work and how to use in segments?

You are here:
Estimated reading time: 2 min

“Tags” represent a special attribute for users, because it can contain multiple unique values.

Tags values are converted into lowercase, and any character non alpha-numeric is removed.

MY Tag &#= IS Nice” will be saved as “mytagisnice”.

Adding tags to users

You can only send Tags along with “login” and “update” events to add all those values to user tags. Passing tags along with other events are ignored.

If a tag is sent multiple times, it will only appear once in users’ tags. To send more than one tag, pass a list of tags, otherwise send it as a simple string/text.

[“tag1”, “tag2”, “tag3”, “tag4”] is equivalent with sending “tag1;tag2;tag3;tag4”

Here is an example of update event:

_vteq.push({"update":{"name": "alex", "tags": ["tag_one", "tag_two"]}})

will update the user tags with: tag_one and tag_two.

User tags in segmentation

Limitation: A single condition related to user tags can be used in a segment!

  • condition: User tags contains tag_one for at least a single tag matching that text
  • condition: User tags equals tag_one for at least a single tag that exactly matches the text
  • condition: User tags contains tag_one|tag_two|tag_three to check if a user has one (any) of the tags
  • condition: User tags equals tag_one;tag_two to return users with both tags
  • condition: User tags does not equal tag_one;tag_two to return users that do not include any of the tags

To display the user tag or tags in an email use  **|user.tags|join(,)|**. All tags, if there are multiple, will be displayed.

IMPORTANT: note the ; and | characters used in the value field!

  • For equals and does not equal we use ; to differentiate between multiple tags;
    • Using Equal will try to match exact tag. If user has “holiday” and “holidayfree” you enter “holiday” to match the “holiday” tag
  • For contains and does not contain we use | to differentiate between multiple values;
    • Contains matches parts of the tags. For example if you enter holi|sun it will match holiday, sunday, alcoholic, holistic, sunshine, holidayfree
  • Note the difference between (not) contain and (not) equal: for contain we look for values inside the tag. So, if you want to look for exact matches always use (not) equal.

Removing tags from users

If you want to remove tags from users, just add – (minus) in front of the tag value.

_vteq.push({"update":{"tags": ["-tag_one"]}})

Examples of segmentation using tags

Segmenting using tags is a bit special compared to other conditions because of how we store tags in the system. Things you need to consider:

  • use contains when you want to check against ANY of the listed values, split by | (pipe)
  • use equals when you want to check against ALL of the values, split by ; (semicolon)

Bad example

Bad example, because User Tags condition is used multiple times.

Good example

User does not have any of the tags: one, second
User tags contains any of the values: alpha, beta, gamma.

Was this article helpful?
Dislike 0
Views: 11