Using Hidden Fields in HubSpot Forms
Hidden fields in HubSpot forms allow you to capture data without requiring user input. This is commonly used for tracking, segmentation, attribution, and automation. This “hack” uses hidden fields strategically to automatically enrich contact records at the point of conversion.
When to Use Hidden Fields
Use hidden fields when you need to:
- Capture campaign or source data
- Pass context from URLs (UTMs, IDs)
- Control lead routing or automation
- Track multi-channel performance
Prerequisites
- Access to HubSpot Forms tool
- Existing or newly created contact properties
- Basic understanding of:
- URL parameters (e.g.
?utm_source=linkedin) - HubSpot workflows (optional but recommended)
- URL parameters (e.g.
Creating and Using Hidden Fields
Step 1: Create or Confirm the Property
- Navigate to:
- Settings → Properties
- Select:
- Object: Contact
- Create or verify property:
- Label:
Campaign Detail - Internal name:
campaign_detail - Field type: Single-line text
- Label:
Step 2: Add Field to Form
- Go to:
- Marketing → Forms
- Open your target form
- Add the property:
Campaign Detail
Step 3: Make the Field Hidden
- Click on the field inside the form editor
- Toggle:
- Make this field hidden
- (Optional) Add a default value if required
Step 4: Pass Values via URL Parameters
Hidden fields automatically populate when:
- The URL parameter matches the internal property name
Example
Form URL:
https://yourdomain.com/demo?campaign_detail=linkedin_q2
Result:
campaign_detail = linkedin_q2is stored on submission
Step 5: Validate Submission
- Submit the form using a test URL
- Navigate to:
- Contacts → Open record
- Confirm:
- Property value is populated correctly
Advanced Configuration
Option A: Use Standard UTM Parameters
HubSpot automatically captures:
utm_sourceutm_mediumutm_campaign
Best Practice:
- Still add hidden fields if you want custom mapping or redundancy
Option B: JavaScript Population (Fallback Method)
Use when:
- Parameters don’t match property names
- You need transformation logic
<script>
document.addEventListener("DOMContentLoaded", function() {
const params = new URLSearchParams(window.location.search);
const value = params.get("campaign");
if (value) {
const field = document.querySelector('input[name="campaign_detail"]');
if (field) {
field.value = value;
}
}
});
</script>
document.addEventListener("DOMContentLoaded", function() {
const params = new URLSearchParams(window.location.search);
const value = params.get("campaign");
if (value) {
const field = document.querySelector('input[name="campaign_detail"]');
if (field) {
field.value = value;
}
}
});
</script>
Option C: Workflow Automation
After submission, trigger workflows to:
- Assign contact owner
- Set lifecycle stage
- Add to lists
- Send internal notifications
Use Case Examples
1. Campaign Attribution
URL:
?campaign_detail=paid_social_retarg_q3
Outcome:
- Enables granular campaign reporting beyond standard UTMs
2. Sales Routing
URL:
?region=emea
Workflow:
- If
region = emea→ assign to EMEA sales team
3. Partner Tracking
URL:
?partner_id=agency_xyz
Outcome:
- Attribute leads to specific partners
Best Practices
- Always use consistent internal property names
- Document all hidden fields in a tracking schema
- Combine with workflows for automation
- Test every form with live URLs before deployment
- Limit usage to relevant fields only
Common Pitfalls
| Issue | Cause | Fix |
|---|---|---|
| Field not populating | Parameter mismatch | Match internal name exactly |
| Data overwritten | Multiple submissions | Adjust property settings or workflows |
| Missing data | Field not hidden correctly | Recheck form configuration |
| Inconsistent reporting | Multiple property names | Standardize naming convention |
QA Checklist (Pre-Launch)
- Property exists and is correct type
- Field added to form
- Field marked as hidden
- URL parameter matches internal name
- Test submission completed
- Contact record verified
- Workflow (if applicable) triggered correctly
Summary
Hidden fields provide a lightweight method to:
- Capture contextual data automatically
- Improve CRM data quality
- Enable advanced automation and attribution
When implemented correctly, they eliminate manual data entry and significantly enhance reporting accuracy.
