Liquid Email
Liquid is an open-source template language designed to help you build dynamic, data-driven content, making it perfect for personalized and interactive emails. With Liquid, you can embed variables and conditionals directly into your HTML. This allows you to create highly customized emails that cater to individual recipients, leading to more engaging and effective campaigns.
How Does It Work?
Variables: Placeholders in the HTML that get replaced with actual data when the email is generated.
Conditionals: Control the content display based on specific criteria, making the email content adaptable to different scenarios.
To better understand the capabilities of Liquid lets follow a couple of examples.
Use of fallback
When greeting users, it's important to display their names. However, if some users haven't set up their names, you can use their username (or specific prefix like Mr, player, friend, etc.) as a fallback.
Set up name Result: Hello, Christopher! Not setup Result: Hello, christopher90!
Use of conditions & variables
Using conditions and variables in Liquid allows you to display personalized user information, significantly boosting user retention and giving the user a sense of exclusivity and personal attention.
For example, below, we are dynamically displaying the day of the week the email is sent, showing information of the last deposit, current balance amount, and showing countdown for promotion. At the same time, all that info is personalized for each recipient.
Example Result: Happy Friday! We miss you! You haven't made a deposit for 5 days, and your balance is really low at 3$. We have an exciting offer for you! If you deposit in the next 20 hours and 50 minutes , we will accumulate an additional 50% bonus to your deposited amount.
Example Result 2: Happy Saturday! We miss you! You haven't made a deposit for more than a month and your balance is at 20$. We have an exciting offer for you! If you deposit in the next 23 hours and 04 minutes , we will accumulate an additional 50% bonus to your deposited amount.
Set a specific timezone
Simply adjust the time to a specific timezone used by the email recipient so they don’t get confused by the system time, which is in UTC time.
Here is a more detailed explanation:
"now" | date: "%s"
- gives us the current time of the Smartico system
current_time | plus: 7200
- is where we set the offset by seconds; plus/minus are used to determine if you want to offset ahead/behind, 7200 seconds = 2 hours
{% assign %}
is used to create and store a value in a variable which you can manipulate or in this instance, use for calculation
{{ adjusted_time | date: "%Y-%m-%d %H:%M" }}
- is what we print to the user, and we define the format %Y-%m-%d %H:%M
(year, month, date, hour, minute)
Warning: beware that the values are case sensitive, for instance %M shows minutes and %m shows month
Result: Christopher, our Amazing Jackpot has reached an astonishing 67000$. Hurry up and play for a chance to win it!
Set a specific translation
If we want to use dynamic tags like day/month but the recipients are from different countries and speak different languages we can assign specific translations:
Spanish user result for Friday: Viernes French user result for Friday: Vendredi
Reminders for missions, jackpots etc.
Boost user engagement by sending email reminders to users when they have progressed in missions but haven’t finished them yet to remind them and trigger user activation. Give users a nudge on the rising Jackpot and motivate them to play more.
Jackpot amount:
Result: Christopher, our Amazing Jackpot has reached an astonishing 67000$. Hurry up and play for a chance to win it!
Missions in progress:
Result: Christopher, do you know that your “Play 5 Mini-Games” mission is still in progress? Finish it and you will get 10 Free Spins!
URL Encoding and Decoding
URLs can be encoded and decoded directly within your email template using `url_encode` and `url_decode`.
Result: https://example.com/questions%3Fwhat-is-the-question%23Answer%231
Many more...
Check all Liquid supported filters and commands below:
Last updated
Was this helpful?