This feature available on All Plans
Overview
In certain situations, you may want to streamline the user experience by pre-filling form fields with information already collected elsewhere. By appending query string parameters to your campaign URL, you can automatically populate specific fields in your ShortStack form. This guide walks you through the setup process.
Setting Up Your Form Container and Field Widgets
-
Add a Form Container:
- In the Campaign Builder, insert a Form Container to your campaign.
-
Add Field Widgets:
- Within the Form Container, add Field Widgets corresponding to the data you wish to collect (e.g., Name, Email, Country).
-
Publish Your Campaign:
- Once your form is set up, publish the campaign to generate the Campaign URL.
For a visual demonstration, refer to the following video:
When you're finished setting up your form, note which fields you want to have auto-filled, as you'll need to keep those in mind when setting up your URL. Then, publish your campaign so that you have the Campaign URL to use as a base for the next step.
Constructing Your Campaign URL with Parameters
To pre-fill form fields, you'll need to append query string parameters to your Campaign URL. The format is as follows:
https://yourcampaignurl.com?parameter1=value1¶meter2=value2
Steps:
-
Identify Field Names:
- Determine the field names in your ShortStack form that you wish to pre-fill. It's advisable to use these exact names as parameters to avoid confusion.
-
Create the URL:
-
Append each field name and its corresponding value as a query string parameter to your Campaign URL.
-
For example:
-
https://yourcampaignurl.com?email=example@example.com&country=USA
Handling Multi-Section Fields
For fields with multiple sections (e.g., First Name and Last Name), separate the values using a pipe character (|
).
Example:
https://yourcampaignurl.com?name=John|Doe
This will populate "John" in the First Name field and "Doe" in the Last Name field.
Adding Action Widgets to Your Campaign
To ensure the query string parameters populate the correct form fields, you'll need to set up Action Widgets for each parameter.
Steps:
-
Add an Action Widget:
- In the Campaign Builder, add a new Action Widget.
-
Set the Condition:
- Click Add When.
- Select The campaign has finished loading under the Campaign category.
- Click Save.
-
Add the Action:
- Click Add Action.
- In the Widget section, select the specific field you want to auto-fill (e.g., Email).
- In the Action section, choose Set field value.
- In the Field Value section, select Use the value from a query string parameter.
- Enter the corresponding parameter name (e.g.,
email
). Ensure it exactly matches the parameter used in your URL. - Click Save.
-
Repeat for Additional Fields:
- Repeat steps 1-3 for each additional field you wish to auto-fill.
Ensure that the parameter names in your URL match the ones specified in the Action Widgets to facilitate accurate data population.
Testing Your Setup
After configuring your form and Action Widgets, click Publish Changes in the top right corner of the Builder:
-
Access the Campaign via the Modified URL:
- Use the constructed URL with query string parameters to access your campaign.
-
Verify Field Population:
- Ensure that the specified form fields are pre-filled with the correct information based on the URL parameters.
-
Test with Different Data:
- Test the URL with various data to confirm consistent functionality.