Overview
If you’d like a cleaner URL than what the Simple Query String Parameter setup provides, you can achieve this by using Action Widgets. This method allows you to set parameters without relying on the automatic labels generated by ShortStack.
Setting Up Your Form Container and Field Widgets
- In the Campaign Builder, add a Form Container to your campaign.
- Add Field Widgets corresponding to the data you wish to collect (e.g., Name, Email, Country).
- Once your form is set up, publish the campaign to generate the Campaign URL.
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:
- 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.
- Append each field name and its corresponding value as a query string parameter to your Campaign URL.
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.
- In the Campaign Builder, add a new Action Widget.
- Click the blue + button under WHEN.
- Select The campaign has finished loading under the Campaign category.
- Click Save.
- Click the blue + button under THEN.
- In the Widget section, select the specific field you want to auto-fill (e.g., Email).
- In the Event 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 steps 1-10 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:
- Use the constructed URL with query string parameters to access your campaign.
- Ensure that the specified form fields are pre-filled with the correct information based on the URL parameters.
- Test the URL with various data to confirm consistent functionality.