You can use filters in Clips to carry out simple calculations, such as multiplying, rounding or capping numerical values. In this guide we'll go through some ways you can use these filters to create custom donation amounts in emails.
Getting Started: What Donation Clips Are Available?
There are several fundraising Clips available in Action Network, but the ones we'll focus on to create custom donation amounts are the Highest Previous Donation, and Latest Donation Amount Clips.
- Highest Previous Donation: This will return the highest previous donation amount as a numerical value.
- Latest Donation Amount: This will return the most recent donation amount as a numerical value
By using these Clips we can include more appealing donation amounts in emails, based on an Activist's previous donation history.
What Filters Can I Apply To These Clips?
There are several filters available. We won't use all of them in these examples, but you can get creative and combine Clips to get the result you desire.
Filter | Effect | Example | Result |
at_least | This filter limits numbers to a minimum value. | {{ 4 | at_least: 10 }} {{ 4 | at_least: 3 }} | 10
4 |
at_most | This filter limited numbers to a maximum value. | {{ 20 | at_most: 10 }}
{{ 10| at_most: 15}}
| 10
10 |
ceil | This filter round values up to the nearest whole number. | {{ 3.33 | ceil }}
{{ 19.01 | ceil }} | 4
20 |
default | This filter inserts a default value where none is available. | {{ HighestPreviousContribution | default: 5 }} | 5 |
divided_by | This filter divides a value by a defined number. | {{ 20 | divided_by: 2 }}
{{ 20 | divided_by: 4}}
| 10
5 |
floor | This filter rounds values down to the nearest whole number. | {{ 3.33 | floor }}
{{ 19.01 | floor }}
| 3
19 |
minus | This filter deducts one value from another. | {{ 20 | minus: 5 }} | 15 |
plus | This filter adds one value to another. | {{ 20 | plus : 5 }} | 25 |
round | This filter will round a value to the nearest whole number. | {{ 19.59 | round }}
{{ 3.33 | round }} | 20
3 |
times | This filter multiplies a value by a defined number. | {{ 5 | times: 4 }}
{{ 3.50 | times: 2 }} | 20
7 |
Can Filters Be Combined?
You can apply multiple filters to a single Clip, for example defining a range using at_least and at_most filters, and including a default filter to ensure a value will be displayed for those who haven't previously donated. Let's look at an example Clip with filters, and how this would be displayed in an email.
{{ HighestPreviousContribution | at_least: 5 | at_most: 20 | default: 10 }}
- For an activist who has made no previous donations the value displayed will be 10.
- For an activist whose highest previous donation is £3, the value displayed will be 5.
- For an activist whose highest previous donations is £25, the value displayed will be 20.
- For an activist whose highest previous donation is £12, the value displayed will be 12.
Using Clips To Personalise Donation Amounts In An Email
Ask An Activist To Match, Or Double A Previous Donation
For this example we'll start with the Highest Previous Donation Clip and add the times filter to the second value.
- To match a previous donation: {{ HighestPreviousContribution }}
- To double the previous donation: {{ HighestPreviousContribution | times: 2 }}
These Clips will work fine for anyone who has made a previous donation, but we'll need to add in a default value for anyone who hasn't previously donated.
- To match a previous donation: {{ HighestPreviousContribution | default: 5}}
- To double the previous donation: {{ HighestPreviousContribution | times: 2 | default: 10 }}
The times filter only applies to the value of the HighestPreviousDonation, and so the default values need to be different. Now we need to add the text that accompanies our Clips, remembering to add a pound (£) symbol before the Clip. So we may end up with something like this:
Can you chip in £{{ HighestPreviousContribution | default: 5}}, or perhaps £{{ HighestPreviousContribution | times: 2 | default: 10 }}?
Which, for an Activist whose highest previous donation is £15 will read as:
Can you chip in £15, or perhaps £30?
And, for an Activist with no previous donations:
Can you chip in £5, or perhaps £10?
Create A Range Of Suggested Donations Based On The Highest Previous Donation Amount
Again, we'll start with the Highest Previous Donation Clip. This time we'll create three values:
- Suggested Donation One: {{ HighestPreviousContribution }}
- Suggested Donation Two: {{ HighestPreviousContribution }}
- Suggested Donation Three: {{ HighestPreviousContribution }}
This time we want to create a low, medium and high donation ask and will use a combination of divided_by and times filters.
- Suggested Donation One: {{ HighestPreviousContribution | divided_by: 2 }}
- Suggested Donation Two: {{ HighestPreviousContribution | times: 1.25 }}
- Suggested Donation Three: {{ HighestPreviousContribution | times: 2 }}
The HighestPreviousDonation value is rounded down to a whole number automatically, so somebody who previously donated £5 will see £2 as the value for Suggested Donation One. We might consider this too low, and want to use the at_least filter to define a minimum amount. To prevent the possibility of duplicate values being displayed we'll apply this filter to each Clip, with a different value.
- Suggested Donation One: {{ HighestPreviousContribution | divided_by: 2 | at_least: 3 }}
- Suggested Donation Two: {{ HighestPreviousContribution | times: 1.25 | at_least: 10 }}
- Suggested Donation Three: {{ HighestPreviousContribution | times: 2 | at_least: 20 }}
As we've defined a value using the at_least filter we don't need to set a default value, as this value will be determined by the at_least value if no previous donation is available. Now, we just need to add the surrounding text, remembering to use the pound (£) symbol ahead of each Clip. So we may end up with something like this:
We're asking if you can help with a donation of £{{ HighestPreviousContribution | divided_by: 2 | at_least: 3 }}, or £{{ HighestPreviousContribution | times: 1.25 | at_least: 10 }}, or even £{{ HighestPreviousContribution | times: 2 | at_least: 20 }}.
An Activist who has previously donated £20 will see this as:
We're asking if you can help with a donation of £10, £25, or £40.
And an Activist with no previous donations will see:
We're asking if you can help with a donation of £3, £10, or £20.
Create A Pre-Filled Donation Link By Combining URL Parameters & Clips
Having suggested amounts for donations is great, but it's even better to have pre-filled donation links set up using your suggested amounts. To do this we just need to combine our Clip with a URL parameter.
1. Create your email as normal, and add in a Clip for the donation amount you want to use into your text. In this example we're asking recipients to make a donation of double their highest previous contribution, and have used the at_least filter to set a minimum value of £20.
2. Highlight the text that you want to make into a link.
3. Click on the link icon in the text editor menu.
4. Add in the URL of your Fundraiser.
5. As we want to set the amount value to that of our Clip we need to append the URL with a question mark (?), the amount key, an equals sign (=), and then the Clip value as our amount value. So our final URL will look like this: https://actionnetwork.org/fundraising/give-us-your-money?amount={{ HighestPreviousContribution | times: 2 | at_least: 20}}
6. Once you've added your link click Save and it will be inserted into your email.
Remember, it's important to test every email before sending- but when using Clips it's essential you thoroughly check that they appear as you expect in your final email.