Articles on: Social Proof

Using Functions in Templates

ONE+ templates support mustache templates and lets you adjust the look and feel of specific notification variables (first_name, city, etc) and even add fallbacks using functions

You can add functions into templates by using pipes ("|"), then space, then the function name or a "||".

Check out examples of supported functions...



{{ variable | number }}

If a number is more than 3 digits, it gets formatted with commas.

_10122 visitors are on your site right now -->_ _10,122 visitors are on your site right now_



{{ variable | propercase }}  --> _Test_

{{ variable | downcase }}  --> test

{{ variable | upcase }}  --> TEST

If you get variable names that may not be formatted with the right case, use the case variable to standardize it. Especially helpful for name variables where users input the name themselves. 

{{ first_name | propercase }}


_JASon -->_ _Jason_



{{ variable | replace[Devil's Canyon Cup from the Devil's Canyon Brewing Company, Canyon Cup] }}

In scenarios where you have a standard variable that is being sent that you want to replace in all cases, you'd use Replace. This is helpful when the variable is something like text that is too long or complicated, and you want to replace it with something shorter/easier.

To use it add the "replace" function, followed by two "arguments" inside [ ] brackets.

The first argument is the value to be replaced, and the second argument is the new value to replace it with.


Jason bought the `Devil's Canyon Cup` `fro``m` `the Devil's Canyon Brewing Company` in the last hour


Jason bought the Canyon Cup in the last hour



`{{ title | delete [,] }}`

If there are specific characters that you want to ignore, you can call them out to remove them. This works well for scenarios where small characters (like periods, commas, etc) impede readability. 

For example, if your {{ title }} value is "Large, Pants" you can remove the comma.


Jon bought Large, Pants 10 minutes ago


Jon bought Large Pants 10 minutes ago

You can further customize by deleting just one instance of a character in cases where In case there are multiple instances

Ex: {{ title }} is "Some. random. example. with periods"

{{ title | delete_first [.] }}  => "Some random. example. with periods"
{{ title | delete_last [.] }}  => "Some. random. example with periods"



{{ variable | truncate }} 

This reduces the variable's length to 30 characters.


The quick dog jumps over the lazy brown fox before running around and around the field as the fox watched on.


The quick dog jumps over the...

You can further specify the exact length by adding a param to represent the number of characters

{{ variable | truncate 15 }}


The quick dog jumps over the lazy brown fox before running around and around the field as the fox watched on.


The quick dog ju...



{{ variable | first_letter }}

Just like truncate, but it leaves just the first character of the variable. If you want to show just first initial, or customer initials or similar, this is what you use. This reduces the variable to the first character. Similar to truncate, but easier for display names as initials and such. 







{{ title_with_link | delete_after[ - ] }}


{{ title_with_link | delete_before[ | ] }}

Used when variable lengths are unpredictable, and Turncate doesn't give you enough flexibility, you may be able to use delete to delete whole character blocks before and after defined characters.

{{ title_with_link | delete_after[ - ] }}:

"Case of 6 Wine Glasses - Unlimited Returns and Fast Shipping!"


"Case of 6 Wine Glasses"



{{ title_with_link | delete_before[ | ] }}:

"Last Chance - Case of 6 Wine Glasses"


"Case of 6 Wine Glasses"

To use the trim_before and trim_after functions, put unwanted character "delimiter" inside [ ] brackets, following the function name and a space.


Default Fallbacks

{{ variable | fallback[fallback word] }} 

When data is incomplete, you can have a fallback to cover. 

{{ first_name | fallback[A new customer] }} --> "A new customer" if first_name is blank


Random Fallbacks

{{ variable | fallback_random[A marketer,Someone great] }}

Same as fallback, but to give your notifications more variety so that they don't get stale to visitors.

You can add fallback_random  function on multiple variables at once. Separate options via commas

{{ first_name | fallback_random[A new customer, a new sign-up, a new user, a new social proofer] }}

Updated on: 11/01/2023

Was this article helpful?

Share your feedback


Thank you!