Hidden Fields and URL Parameters
Hidden fields capture data behind the scenes without showing anything to your respondents. They are one of the most powerful tools for tracking where your submissions come from, attributing leads to marketing campaigns, and passing contextual data into every response.
What Are Hidden Fields?
A hidden field is a form field that is invisible to the person filling out the form. It collects data automatically based on a data source you configure. When the form is submitted, the hidden field value is saved alongside all the visible field responses, giving you extra context about each submission.
Common use cases include tracking which ad campaign brought a lead, identifying the page a user was on before they opened the form, or pre-filling a customer ID for logged-in users.
Adding a Hidden Field
To add a hidden field to your form:
- Open the form editor and look for Hidden Field in the field panel under the Advanced category.
- Click it or drag it onto the canvas. The field will appear with a dashed border and an eye-slash icon to indicate that it is hidden from respondents.
- Give the field a descriptive label (e.g., “UTM Source” or “Referrer URL”). This label is only visible to you in the editor and in your response data.
- Select a data source to determine how the field gets its value.
Data Sources
WittyForm supports four data sources for hidden fields. Each one captures a different type of information automatically.
Static Value
A static value is a fixed string that you set in the editor. Every submission will contain the same value for this field. This is useful when you embed the same form on multiple pages and want to know which page generated the submission. For example, you might set the value to “pricing-page” on one embed and “homepage” on another.
URL Parameter
The URL parameter source reads a value from the query string of the page URL. When a respondent visits yoursite.com/form?source=google, a hidden field configured to read the source parameter will capture “google” as its value.
To configure this, enter the parameter name (e.g., source) in the field settings. If the parameter is not present in the URL, the field will be empty unless you set a default value.
Cookie
The cookie source reads a value from the visitor’s browser cookies. This is helpful for capturing values set by your website or third-party tools. Enter the cookie name in the field settings, and WittyForm will read the cookie value when the form loads.
A common use case is reading a user ID cookie set by your authentication system, so every form submission is automatically linked to the logged-in user.
Referrer
The referrer source captures the URL of the page the visitor was on immediately before arriving at the page with your form. This uses the browser’s built-in referrer header. It is useful for understanding the traffic flow that leads to form submissions.
Note that some browsers and privacy tools may strip the referrer header. If the referrer is not available, the field will be empty.
Passing Data via URL Parameters
The most common way to populate hidden fields is through URL parameters. Append parameters to your form URL or the page URL where your form is embedded using the standard query string format:
https://yoursite.com/contact?utm_source=google&utm_medium=cpc&utm_campaign=spring_sale
Each parameter maps to a hidden field by its configured parameter name. You can pass as many parameters as you need. WittyForm will parse the URL and populate each matching hidden field automatically.
If you are sharing a WittyForm-hosted form link, the same approach works:
https://wittyform.com/form/your-form-id?ref=newsletter&campaign=march
Tracking UTM Parameters
UTM parameters are the standard way to track marketing campaigns. Most advertising platforms and email tools append UTM parameters to your links automatically. To capture them in WittyForm:
- Add a hidden field for each UTM parameter you want to track:
- utm_source — Where the traffic comes from (e.g., google, facebook, newsletter).
- utm_medium — The marketing medium (e.g., cpc, email, social).
- utm_campaign — The specific campaign name.
- utm_term — The paid search keyword (optional).
- utm_content — Differentiates ad variations (optional).
- Set each hidden field’s data source to URL Parameter and enter the matching parameter name.
- Make sure your ad links and email links include the UTM parameters in the URL.
Every submission will now include the UTM data, letting you trace each lead back to the exact campaign, source, and medium that generated it.
Using Hidden Fields for Attribution
Hidden fields are the foundation of lead attribution in WittyForm. By combining multiple hidden fields, you can build a complete picture of how each respondent found your form:
- First-touch attribution — Capture UTM parameters on the first visit and store them in cookies. Use hidden fields with the cookie data source to read those values even if the user submits the form on a later visit.
- Last-touch attribution — Use URL parameter hidden fields to capture the most recent campaign data at the time of submission.
- Page-level tracking — Use a static value or referrer hidden field to identify which page the form was submitted from.
- User identification — Use a cookie hidden field to capture a logged-in user’s ID or email from your application.
Viewing Hidden Field Data in Responses
Hidden field values appear alongside all other field data when you view individual responses. They are displayed in the response detail panel with a subtle indicator showing that they are hidden fields.
You can also use hidden field values to filter and segment your responses. In the responses table, add a column for any hidden field to sort and filter by campaign, source, or any other value you are tracking.
When exporting responses to CSV or connecting to integrations like Google Sheets, hidden field data is included as regular columns in the export.
Best Practices
- Use clear, consistent naming for your hidden fields and URL parameters across all forms and campaigns.
- Always set a default value for URL parameter fields so you have a fallback when the parameter is missing (e.g., “direct” for utm_source).
- Test your hidden fields by previewing the form with URL parameters appended and checking that the values appear in the preview response.
- Avoid storing sensitive data in hidden fields populated from URL parameters, as URLs are visible in browser history and server logs.
- Combine hidden fields with conditional logic to create different form experiences based on the data source or campaign.