Do you want to make smarter use of the tags you've given your customers? In a newsletter or trigger, for example? You can!
You've probably already seen the option under 'merge tags', display a tag:
Or, simply press @, you'll see all the merge tags in a dropdown menu:
โ
But how do you use this option smartly? In this article, we will discuss how to separate tags when your client has multiple tags in the profile.
Separate tags with a comma
When you use the liquid "display a tag", this is what it looks like in your newsletter or trigger:
My customers have indicated which pet they are interested in receiving specific newsletters about.
In the email, these tags will appear one after the other, like this:
You solve this by adding a comma to the liquid so that the words are separated from each other. My liquid then becomes as follows: {{ tags | join: ', ' }}
Which looks like this in your email:
When I send a test to myself, I see the following:
The tags are now separated from each other with a comma in between. Pretty neat.
Want to separate the tags with 'and' between them? Then use: {{ tags | join: 'and ' }}
Show a specific tag
Have you just had your customers fill out a form, and you want to show this tag again in the follow-up email? For example: 'Thank you for filling in your details! You chose .....'
What is good to know in that case is that you then take the last tag from the profile. For this, you enter the following liquid: {{ tags | last }}
Then, your sentence will be:
Is your tag a whole sentence? Then you might notice that your tag is divided into underscores: 'Thank you for filling out your information! You chose fall_and_winter_collection'
In that case, you need additional liquid, which ensures that the underscores are replaced by a space. To do this, use the following liquid code: {{ tags | last | replace: '_', ' ' }}
Do you want to create an email specifically for the first tag? Then use the following liquid: {{ tags | first }}