This guide provides tips and tricks for creating a URL which can be used to pre-fill fields of a form.
Why prefill a form?
Prefilling a form is used to fill out specified fields with predetermined values such that Donor/Member does not have to make the selection themselves. Combine with showing and hiding fields to simplify the form. If you know any Contact data, you can save the Donor/Member some time by filling out the form in advance.
Which value overrules which?
The hierarchy for pre-filling value is as follows:
- Embed-script overrules the deep link
- Deep links pre-fill the form and overrule default values
- The form contains the configuration of default values
Content of this article
- How to customise deep link
- Overview of parameters
- Main Example
- Tip & tricks
- FAQ
1. How to Customise Deep Link
Use the link of the landing page which contains the form and make any additions at the end of the link. Customise the link in your preferred text editor. Each field must abide to the following syntax:
pre_fieldName=fieldValue
For instance, if you wish to pre-fill amount with 100 kroner, the link will look like this:
https://www.YourUrl.dk/toTheForm?pre_amount=100
If you aim to add more than one parameter you can do so by adding a "&" sign after the first parameter. In the following example, a yearly frequency is added as well as the amount:
https://www.YourUrl.dk/toTheForm?pre_amount=100&pre_recurringFrecuency=yearly
Before You Start
Please note the following when customising a deep link:
- The fields you are attempting to prefill must be present in the form (visible or hidden). Fields may have specific requirements - these are listed in the section Overview of Parameters.
- It is not possible to prefill multi-select fields.
2. Overview of Parameters
Below you will find a list of common fields and how to add them as parameters to your link. Further down in the article you will find a guide to how you can pre-fill the field (parameter). Your form must contain the field you are aiming to pre-fill.
2.1 Contact Data
The following are the most common fields for Contact data used in forms:
-
Full name: pre_name=First name Middle name Last name
Use this field if you only have one name field. If you are using multiple name fields, please see descriptions below.
-
First name: pre_firstName=First name
Denne og nedenstående bruges sammen, hvisInput Typef.eks. er First- and lastname.
-
Last name: pre_lastName=Last name
Se ovenstående.
-
Business name: pre_businessName=Business name
-
E-mail: pre_email=navn@foreningsnavn.dk
-
External ID: pre_externalId=123qwerty
This field is commonly used in integrations with e.g. CRM-systems.
-
Phone: pre_phone=12345678
It is possible to prefix the phone number with a country code, e.g. "45", but it cannot contain "+".
-
Birth date: pre_birthDate=1900-02-25
Without CPR and in the format yyyy-mm-dd.
Please note that if configuring the field as a date field improves the data quality.
-
Full CPR nr.: Pre-filling this field is not considered responsible in terms of GDPR.
-
Business ID- CVR nr.: pre_businessCode=37273457
CVR number automatically looks up additional information from the CVR API.
-
Address: pre_address=Finsensvej 6, 2 tv
Provide both space characters and special characters.
-
Postal code.: pre_postCode=2000
-
City: pre_city=Frederiksberg
-
Country code: pre_countryCode=dk
The country code consists of 2 letters. Please refer to the following list of Alpha-2 codes for more information: Alpha-2 code.
-
Contact Type: pre_contactType=individual
Two types exist:
- Private
- Business
2.2. Transactions
-
Amount: pre_amount=100
The prerequisites of this example is that (1) an amount of 100 is configured or (2) the field is open amount.
-
Purposes: pre_purpose=1
If you provided multiple purposes in the form, the pre-fill can be used to specify the purpose. The numeric value denotes the order of the purpose in the form.
In other words, if you have 3 memberships in the following order: 1: Veteran, 2: Senior, 3.: Junior, pre_purpose=1 would result in selecting Veteran.
If you provided an amount on the purpose, this amount is applied first, because it is considered to be more important. If you aim to use purpose to decide the amount we recommend setting the input type of the amount field to number.
-
Payment Type: pre_paymentType=Recurring
As part of the form configuration it is possible to control the order of payment type, i.e. if it is single or recurring. Pre-filling this field is especially useful if the field is hidden. The following values are available:- Single payment= pre_paymentType=Single
-
Recurring payment= pre_paymentType=Recurring
-
Payment Method: pre_paymentMethodType=Card
As part of the form configuration it is possible to control the order of the payment methods. The following values are available (not a complete list):- Card= pre_paymentMethodType=Card
- MobilePay= pre_paymentMethodType=MobilePay
-
Betalingsservice= pre_paymentMethodType=Betalingsservice
-
Frequency: pre_recurringFrequency=monthly
If you configure a frequency as part of embedding the form, it can be useful to simplify the form by hiding the field and pre-filling the value using a deep link. The following values are available:- Monthly= pre_recurringFrequency=monthly
- Six times a year= pre_recurringFrequency=hexannually
- Quarterly= pre_recurringFrequency=quarterly
- Three times a year= pre_recurringFrequency=triannually
- Biannually= pre_recurringFrequency=biannually
-
Yearly= pre_recurringFrequency=yearly
-
Recurring start (of agreement): pre_recurringStart=now
The recurring start is commonly set in the background, i.e. the field is hidden in the form and determined by additional logic, e.g. via a deep link. The following values are available:- Immediately= pre_recurringStart=now
- Custom= pre_recurringStart=custom
- Specified start date= pre_recurringStart=yyyy-mm-dd
- Immediately, and first day of next month= pre_recurringStart=now_and_first
-
First day of next month= pre_recurringStart=first
-
Expiration date (of agreement): pre_recurringExpiration=yyyy-mm-dd
-
Lock pre-filled fields = pre_lock="1"
If the parameter is included in the deep link, the remaining parameters (fields) included in the link cannot be modified once the have been pre-filled via the deep link.
-
Change Payment Method = change_payment_method={subscriptionGuid}
Use this parameter to provide a Donor or Member with a direct link to change their payment method. Please refer to the following guide for more information: Change Payment Method.
2.3. Custom Fields
-
Create your own field = pre_reference
If you created a custom field and aim to pre-fill the field, e.g. while it is hidden from the form, use the reference as parameter in the deep link. An example is provided below.
The above image shows a custom field with the reference: internt-kampagne-id. The parameter for the deep link will then be: pre_internt-kampagne-id=vinter2020, where "vinter2020" is an example campaign code.
3. Main Example
Below is an example of the following case: We wish for the donor to pay 75kr using MobilePay biannually. The donation is in context of the campaign with code: vinter2020.
https://www.JeresUrl.dk/tilFormularen?pre_paymentMethodType=MobilePay&pre_amount=75&pre_recurringFrequency=biannually&pre_internt-kampagne-id=vinter2020
4. Tips & Tricks
Customise your embed script to fit your organisation's needs. For instance, it is possible to reuse a form for different campaigns by presetting the purpose behind the scenes.
Example
In this example your organisation is running two campaigns. Landing pages have been created for the following campaigns:
- Campaign A encourages donors to make a single donation using MobilePay
- Campaign B encourages donors to commit to recurring payments using Card
Each campaign is communicated differently and are exposed on separate landings pages. It is possible to use the same form on both landing pages.
How it's done
Campaign A has the URL www.yourpage.io/donate which contains a customised embed script which presets the Payment Method to MobilePay and the Payment Type to Single. In this example we assume that the Purpose selection is 1, i.e. the first Purpose configured for the form.
https://www.yourpage.io/donate?pre_paymentMethodType=MobilePay&pre_paymentType=Single&pre_purpose=1
Campaign B has the URL www.youpage.io/signup, where the Payment Method is preset to Card, and the end-user signs up for an agreement with monthly payments starting the first of the month. As a result, the payment type is recurring. The purpose is different to that of Campaign A.
https://www.youpage.io/signup?pre_paymentMethodType=Betalingsservice&pre_paymentType=Recurring&pre_recurringFrequency=monthly&pre_recurringStart=first&pre_purpose=2
Remember to always test the custom embed script before publishing to the end-user.
5. FAQ
-
Why is a field not successfully pre-filled in the form?
- Please ensure that the form is configured for the value in question. For instance, if the pre-fill parameter for frequency is attempting to fill out annual, but the form only accepts the frequencies: monthly, biannual, the pre-fill will not take effect.
-
How are multi-select fields pre-filled?
- It is currently not possible to pre-fill multi-select fields.
-
Is it possible to pre-fill a hidden field?
- Yes, it is possible to pre-fill a hidden field, so long as it exists in the form. We recommend testing thoroughly to ensure that the form is configured correctly.