
A sales team receives an inquiry and wants to know which service the visitor was considering. Asking the visitor to type an internal service code adds friction; losing that context makes follow-up slower. A Contact Form 7 hidden field can carry a small piece of context alongside the visible answers.
The useful distinction is between carrying context and establishing trust. A hidden field is absent from the visible form, but its value remains available in the browser and can be changed. This guide explains how to add one, get the value into your message, and keep the resulting reports understandable. For campaign attribution specifically, use our separate UTM tracking guide.
Choose a value that has a clear purpose
Start with the question the recipient will answer using the field. A service code such as website-review could help distinguish inquiries from several landing pages. A template revision such as inquiry-v2 could help a developer identify which form configuration produced a record. Neither value should contain information the visitor is not allowed to inspect.
Avoid collecting context merely because a field is easy to add. Every extra value must be understood by the email recipient, storage plugin and any connector that forwards it. Write a short definition before implementation: field name, permitted values, origin, destination and owner. That small agreement prevents the same code from gradually acquiring different meanings across a spreadsheet and CRM.
Add a basic hidden form-tag
Contact Form 7 supports the hidden form-tag. A simple fixed value can be declared in the Form tab:
[hidden service-code "website-review"]
[hidden form-revision "inquiry-v2"]
These are example names and values, not settings that should be copied unchanged into every form. Use a distinct name for each field and keep it stable once a downstream mapping depends on it. The official hidden-field documentation also documents ID, class and default-source options.
For a first implementation, a fixed value is easier to inspect than a JavaScript-populated field. It lets you confirm that the field is present and arrives correctly before introducing timing, caching or default-value rules. Build one small working path, then add complexity only when the workflow requires it.
Include the value in the Mail template
Defining a field does not automatically make its value visible in an email template. Add the matching mail-tags to the message body in the Mail tab:
Service context: [service-code]
Form revision: [form-revision]
The field name connects the form-tag and mail-tag. If a colleague later renames service-code in the form, the message and connector mappings need review too. Place operational context below the visitor’s useful answers so the recipient can read the inquiry naturally.
Check the actual message output, including what happens when a value is blank. Contact Form 7’s mail setup guide describes mail-tags and the option to exclude lines with blank values. A missing line and an explicitly empty context field are different clues during diagnosis, so choose the presentation deliberately.
Treat default values as a separate implementation
The plugin supports obtaining defaults from defined sources. If you use default:shortcode_attr, the custom shortcode attribute must also be registered; adding an arbitrary attribute to the page’s shortcode alone is insufficient. Follow the complete official shortcode-attribute procedure rather than copying only its visible shortcode example.
Record where the value is calculated and when it becomes available. A page rendered from cache, a form inserted into a modal and a visitor returning through browser history can expose assumptions that a single fresh-page test misses. If context changes during the visit, specify whether the record should preserve the initial context or the context at submission. Those are reporting decisions, not interchangeable technical details.
Keep hidden values outside authorization decisions
MDN explains that hidden input values can be inspected and edited through browser tools. Hidden inputs also do not participate in normal browser constraint validation. Their invisibility therefore does not make them an appropriate place for API secrets or an authoritative statement about a person’s permissions. See the HTML hidden-input reference.
For business rules, use the submitted context as a claim to check. If a service code affects routing, match it against a permitted server-side list. If a record identifier refers to an existing customer, establish that customer’s access separately. Do not let a visitor-selected field decide a price, account privilege or unrestricted destination address.
A helpful naming convention is to describe what was supplied: submitted-service-code is clearer in an audit than a column called verified-service when no verification occurred. Keep the original value and the validated classification distinct if the receiving system performs that validation.
Test the complete path with synthetic inquiries
- Inspect the rendered form and confirm both field names and initial values.
- Submit a synthetic inquiry in an approved test environment and inspect the resulting mail body.
- Check the storage or connector destination separately; do not assume it captures every hidden field.
- Try a missing and an unexpected value and verify the agreed handling.
- Repeat after a page reload and any modal or cached-page path your visitors use.
Compare one submission across the whole path. A correct email does not prove that an Airtable column or Notion property received the same value. Our Airtable workflow and Notion workflow explain destination mapping; use them when those systems are part of your implementation.
Use context to explain reports
Keep a small dictionary of service codes and revision dates next to your report. When a category changes, annotate the change instead of treating the resulting count shift as a change in visitor demand. Review unknown and blank values before making comparisons between landing pages.
Start with our CF7 analytics guide to define the submission measures you need. The free Svetlik Analytics plugin is a starting point for CF7 reporting; verify its current capabilities before assuming that an arbitrary hidden-field dimension is available in a report. Keep context collection useful, limited and easy to trace.
