Using conditional content in your emails and action forms can be a powerful way to customize your content and make your responses to your donors more personal.
We've created several macros which give you some options for comparing, manipulating, and formatting merge field values. First, we'll give you a list of the available macros, and then you can learn more below about how to use them in your conditional content.
Macros that compare values
Use these macros to compare values for your conditional content, such as when your ask depends on whether a contribution amount was less or greater than a specified threshold.
Macros that compare values
Macro | Format | Description |
equals | equals(value1, value2) | This macro compares two values and returns true if value1 is equal to value2, otherwise it returns false. |
not_equals | not_equals(value1, value2) | This macro compares two values and returns true if value1 does not equal value2, otherwise it returns false. |
less_than | less_than(value1, value2) | This macro compares two values and returns true if value1 is less than value2, otherwise it returns false. |
less_than_or_equal_to | less_than_or_equal_to(value1, value2) | This macro compares two values and returns true if value1 is less than or equal to value2, otherwise it returns false. |
greater_than | greater_than(value1, value2) | This macro compares two values and returns true if value1 is greater than to value2, otherwise it returns false. |
greater_than_or_equal_to | greater_than_or_equal_to(value1, value2) | This macro compares two values and returns true if value1 is greater than or equal to value2, otherwise it returns false. |
Macros that manipulate values
Use these macros to manipulate a value, such as when you want to ask for a contribution based on a previous amount but want to round the ask amount and have it fit within a minimum and maximum amount.
Macros that manipulate values
Macro | Format | Description |
round_nearest | round_nearest(seed_value, mult) | Starting with a seed or beginning value, this macro outputs a value that rounds to the nearest defined mult value (to closest multiple of 5 or 10, for example) |
min_max | min_max(seed_value, min_value, max_value) | Starting with a seed or beginning value, this macro outputs a value between the defined min and max values. Tip: If any of the 3 arguments are missing, the macro will not output a value. |
round_min_max | round_min_max(seed_value, round_multiple, min_value, max_value) | This macro combines the round_nearest and min_max macros so that you can ask for contribution amounts based on the previous contribution on that contact's record. It can be appended as a querystring to a link to a contribution form. It is typically used in conjunction with the round_currency macro (see below). Tip: If any of the 4 arguments are missing, the macro will not output a value. |
round_currency | round_currency(seed_value, round_multiple, min_value, max_value, currency) | This macro combines the round_nearest, min_max, and format_currency macros so that you can ask for contribution amounts based on the previous contribution on that contact's record. It can be used as the display text for the ask amount, usually linked to a contribution form using the round_min_max macro (see above). |
Macros that format values
Use these macros to format the values output by the amount and date merge fields.
Macro | Format | Description |
format_currency | format_currency(amount, currency) | This allows you to display a given amount in the proper format for the processing currency of that amount. |
format_date | format_date(date_value, format, length, language) | This macro allows you to display a given date in the desired format, length, and language based on the values you choose. The date value is typically a date merge field (which outputs in YYYY-MM-DD). |
How to work with macros
You may be familiar with using macros from other software programs and ours follow a similar pattern. You will see the name of the macro with comma-separated arguments or values listed in parentheses immediately following.
macro_name(value 1, value 2, value 3, etc.)
When entering values, if you want to include specific text or dates as an argument, you will need to enclose them in single quotation marks to make sure they are read exactly as written, rather than assumed to be a merge field or numerical value.
For example,
{{greater_than{{ContributionAmount, 20)}}
compares whatever is the value of the field ContributionAmount to the number 20.
If you want to compare the contents of a field like DOB to a specific date, you would need single quotation marks for the specified date:
{{greater_than{{DOB, '1980-01-01'}}
If you wanted to compare the contents of a field like StateOrProvince to a particular text string such as NY, you would need to enclose the text in single quotation marks:
{{equals(StateOrProvince, 'NY')}}
Notice that the merge field names ContributionAmount, DOB, and StateOrProvince do not have single quotes, nor does the number 20. The specific date 1980-01-01 and the text string NY do need single quotes to be read as specific values in your macro.
