Expressions let your popup show live values, such as the visitor's country, a discount code, or a countdown. You write an expression in double curly braces, and Alia replaces it with its result when the popup shows.
You can use expressions in:
Text elements
Button text
Properties a form sends when it's submitted
Write an expression
An expression is any short piece of JavaScript inside double curly braces:
Shipping to {{ $alia.user.country }} today
This shows the same thing:
{{ "Shipping to " + $alia.user.country + " today" }}Keep expressions simple. Statements and complex syntax, such as JSON, may not work.
Insert an expression without typing code
Select the text or button in the popup editor.
In the right sidebar, select the Insert an expression icon next to the text field.
Choose Visual to pick a value from a list, or </> Code to write your own.
Select Save.
Expressions show as pills in the editor. To change one, select the pill. Edit expressions in the right sidebar, not by double-clicking the text on the canvas.
đĄ Note: The editor only shows expressions that are a plain name, such as {{ discount_code }}. Longer expressions appear blank in the editor. Select Preview to see what they show on your store.
Values you can use
Variables
Variable | What it shows |
| The text of the question the element sits inside |
| The text of the answer the element sits inside |
| The visitor's discount code |
| When the visitor's discount code expires |
| The visitor's phone number, masked so only the last four digits show. Empty until they enter it |
| SMS consent text for a form where the visitor enters their phone number and selects a button |
| SMS consent text in Spanish. The HELP and STOP keywords stay in English |
| SMS consent text in French. The HELP and STOP keywords stay in English |
| Email consent text |
| The offer revealed in a Pick a card game |
The consent texts link to the terms of service and privacy policy you set in Settings. Use question_text and answer_text instead of typing the question or answer twice, so the text always matches what's sent to your integrations.
The $alia object
$alia holds details about the visitor, such as their country, Shopify market, and quiz answers. For example, {{ $alia.user.market }} shows the visitor's Shopify market. See The $alia object in custom code.
Rewards
reward() shows a reward's discount code or its text, such as "15% off":
{{ reward({ id: 12345, property: "text" }) }}Replace 12345 with your reward's ID from the Rewards page. Use "code" to show the code instead.
If the visitor already claimed this reward, it shows the one they claimed.
If not, calling it claims the reward. For a unique code reward, that creates a new code.
To build this without code, choose Reward in the Insert expression window.
Countdowns
countdown() shows a ticking timer. For most countdowns, the Countdown element is easier. See How to insert a countdown timer.
To count down | Use |
A fixed time |
|
To a date |
|
To the end of a period |
|
Add format: "letters" (1d 2h 30m) or format: "colons" (01:02:30) to change how it looks, and units to choose which units show.
Links
link() builds a link to a page on your store. Give it a reward ID to apply that reward's code at checkout. To build a link without code, choose Link in the Insert expression window.
Frequently asked questions
Why does my expression show as blank in the editor?
The editor only runs expressions that are a plain name. Select Preview to see the result on your store.
How do I record the page someone signed up on?
Add a property to the form with the value {{ window.location.pathname }}. Use {{ window.location.toString() }} for the full URL.
Why does only part of my expression work on my store?
If your store's security settings block JavaScript, only expressions that are a plain name, such as {{ discount_code }} or {{ $alia.user.market }}, still work.
Still have questions?
Start a chat from inside the Alia app, or use the chat in our Help Center.


