While RaiseDonors does not yet support custom fields on the donation page, there are two ways to save custom data with a donation.
1. Directly on the donation page which requires some knowledge of javascript.
2. Through the API.
1. Donation Page
Every donation page has a hidden field named "hdnMiscInformation". This is a special field in RaiseDonors which you can add custom information into.
The steps below do require knowledge of Javascript.
The hidden field will already have information stored as pipe delimited. For example:
has-encrypted-url=false|RawUrl=https://raisedonors.com/donate.aspx?org=raisedonors&offer=sample-giving-page-for-donors|ReferringURL=https://raisedonors.com/admin/pages.aspx|Google_utm_campaign=|Google_utm_content=|Google_utm_medium=|Google_utm_source=|Google_utm_term=|hubspotutk=4260e67c855e8c8072de548626ce57bc|
A simple way to think about it is a key/value pair separated with a pipe. It's important that the pipe is always the last character:
{key}={value}|{key}={value}|
With javascript you can append any key/value pair you wish to this hidden field. You can:
- Pull in a parameter from the URL query string
- Make an auxiliary API call to pull in remote data
- Pull a value from a cookie
- Store a value from a custom DOM element
It is important to note that you must leave the existing data in place and not modify it in any way. If you modify or remove ANY of the existing data - you risk the possibility of breaking your donation page.
To use this, you'll be creating a new "key" that begins with "custom_". So if you wanted to add a few custom data points - let's say, Birthday, Gender, and Age. You'd add the following key/value pairs to the hidden fields value:
custom_birthday=1/1/2000|custom_gender=female|custom_age=21|
When the donation is submitted, this data will be saved with the donation. And it will be visible in the admin area when viewing a donation. You can supply the javascript at the page level (ie: per page) or you can write global javascript to be applied to every page.
2. API
When querying donations via the API, RaiseDonors will return a key/value pair similar to the example below, containing all of the custom data for the donation. This data will also be available in the API as a key/value pair. Please note, the API automatically removes "custom_" from the name because the data is contained within a "customDataItems" element.
"customDataItems": {
"transactionId": "123456",
"age": "23"
}
When creating a donation through the API, you will not need to prepend the custom field name with "custom_". Because the custom fields are contained inside of "customDataItems", you only need to supply the name (as exampled above).
And this data will be available in Donation.Created/Edited webhooks.