Skip navigation
User Manual
Overview

Filters

Filters are a means of formatting or performing operations on your object data. They are included in an output tag {{ }} and begin with a pipe character |. Filters can be used in combination, reading from left to right, to perform multiple actions on an object.

default

Specifies some optional default value to be inserted when computed Liquid results in a nil value or an empty string "".

Input

Hey {{ subscriber.first_name | default: “there” }}!

Output

<!-- If subscriber.first_name is nil -->
Hey there!

<!-- If subscriber.first_name is "Bob" -->
Hey Bob!

downcase

Converts the object contents to lower case.

Input

{{ 'Bob' | downcase }}

Output

bob

upcase

Converts the object contents to upper case.

Input

{{ 'bob' | upcase }}

Output

BOB

capitalize

Capitalizes the first letter of the first word in a string.

Input

{{ 'a string of text' | capitalize }}

Output

A string of text

timestamp

Converts a date and time to UNIX time (the number of seconds since 1970) in order to do calculations.

Input

{{ subscriber.signup_date | timestamp }}

Output

1492708640

date

Used with the {{ now }} object to specify the date and time format to be displayed. .

Input

{{ now | date: "%a, %B %d, %Y at %I:%M %p" }}

Output

Thu, April 20, 2017 at 07:15 PM

in_time_zone

Converts a non-UNIX time to the specific time zone. Click here to see examples of common time zone strings, or click here to view the full database of worldwide time zones.

Input

{{ now | in_time_zone: “America/Los_Angeles” }}

Output

2017-04-20 12:15:34 -0700

advance_date_to_next

Advances a date to a specific day in the next 7 days.

Input

<!-- subscriber.created_at = 2017-04-20 20:48:12 +0000-->
{{ subscriber.created_at | advance_date_to_next: “Friday” }}

Output

2017-04-21 20:48:12 +0000

at_midnight

Resets the time to midnight for a specific day.

Input

{{ now | at_midnight }}

Output

2017-04-21 00:00:00 +0000

strip_commas

Removes commas from any string. Useful in situations when you might be unable to control the string used to create a tag (tags should not contain a comma, since several places in Drip ECRM store tags as comma delimited lists). Examples include creating a tag by using a property of a custom event or from an integration that pushes purchase information into Drip.

Input

{{ "this is, my string" | strip_commas }}

Output

this is my string

plus

Adds a value to a number.

Input

<!-- subscriber.lifetime_value = 10 -->
{{ subscriber.lifetime_value | plus: 5 }}

Output

15

minus

Substracts a value from a number.

Input

<!-- subscriber.lifetime_value = 10 -->
{{ subscriber.lifetime_value | minus: 5 }}

Output

5

times

Multiplies a number by specified value.

Input

<!-- subscriber.lifetime_value = 10 -->
{{ subscriber.lifetime_value | times: 2 }}

Output

20

divided_by

Divides a number by specified value.

Input

<!-- subscriber.lifetime_value = 10 -->
{{ subscriber.lifetime_value | divided_by: 5 }}

Output

2

modulo

Divides a number by a specified value and outputs the remainder, if any. This can be used to randomly split a list into “even” and “odd” groups for split testing.

Input

{{ subscriber.signup_date | timestamp | modulo: 2 }}

Output

<!-- Input is an even number -->
0

<!-- Input is an odd number -->
1

round

Mathematically rounds the input to the nearest integer or specified decimal place.

Input

<!-- subscriber.average_purchase = 47.87432 -->
{{ subscriber.average_purchase | round: 2 }}

Output

47.87

ceil

Rounds the input up to the nearest integer.

Input

{{ 25.367 | ceil }}

Output

26

floor

Rounds the input down to the nearest integer.

Input

{{ 75.873 | floor }}

Output

75
x A browser window showing the Drip Swag Shop

Wanna see Drip from a fresh angle?

Craving a more hands-on experience? Take 2 minutes and see what your shoppers see when you use Drip with this interactive experience.

Start my experience