Liquid and variables
Every email can use Liquid to fill in names, plans, links, and anything else you know about the person. In the email editor, click {x} to pick a variable, or type it.
What you can use
| Variable | What it holds | Where |
|---|---|---|
{{ person.properties.first_name }} | Any person property | Broadcasts and automations |
{{ event.properties.plan }} | A property of the event that started the automation | Automations with an event trigger |
{{ variables.reset_link }} | Values your code sends, or values earlier steps saved | Transactional emails and automations |
{{ unsubscribe_url }} | The person's link to the preferences page | Marketing emails. See unsubscribes. |
A transactional email can't read person properties. Your code sends everything it shows.
Add a default
A property can be missing for some people. Add a default:
Use single quotes inside Liquid. A double quote inside a link's href ends the address early and breaks the link.
Properties that start with $
Use brackets and single quotes:
{{ person.properties.$email }} fails, and the email doesn't send.
Show something to only some people
Wrap it in an if:
In the email editor, you can do the same for a whole block: open Who sees it, pick Show only when…, and fill in Only if.
Filters
Filters change a value before it shows, such as upcase, capitalize, date, and truncate:
PostHog adds a currency filter, which takes a currency code, a locale, or both:
The Liquid docs list the standard filters. PostHog turns off the filters that take an expression, such as where_exp and group_by_exp.
Show personal stats
To send each person their own numbers, such as a yearly recap, save the numbers as person properties before you send. Save each one as a plain number, such as 42 for 42%, not as text such as "42%". When a plan has no limit, skip the percentage instead of dividing by zero. Then show them in a broadcast with a Custom HTML block:
- The bar is a table cell with a width, because many mail apps ignore CSS on
divelements. plus: 0turns the property into a number, so the label and the bar start from the same value. Only the bar is limited:at_leastandat_mostkeep it between 0 and 100% when someone is over their plan.- The numbers are part of the email, so you don't need to host a private image.
- For a file, such as a PDF report, link to it. Put it behind the person's login in your app, or use a signed link from your own storage that expires. Add
data-ph-no-trackanddata-ph-no-utmto a signed link. A click then doesn't save its address in engagement events, and no UTM tags break its signature. Marketing emails can't carry attachments.
When it goes wrong
| Error | Fix |
|---|---|
TokenizationError: unexpected character | Replace curly quotes, often pasted from a document, with straight single quotes. |
expected "\|" before filter | A property starts with $. Use person.properties['$email']. |
| A blank where a name should be | The person doesn't have the property. Add a default. |
If Liquid doesn't render, the email doesn't send. Before you go live, pick a real person in Preview as, and send yourself a test.
For the size and send limits on each email, see email and automation limits.





