<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=108825&amp;fmt=gif">
Skip to content
English
  • There are no suggestions because the search field is empty.

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)

Creating and Using Hidden Fields


Step 1: Create or Confirm the Property

  1. Navigate to:
    • Settings → Properties
  2. Select:
    • Object: Contact
  3. Create or verify property:
    • Label: Campaign Detail
    • Internal name: campaign_detail
    • Field type: Single-line text

Step 2: Add Field to Form

  1. Go to:
    • Marketing → Forms
  2. Open your target form
  3. Add the property:
    • Campaign Detail

Step 3: Make the Field Hidden

  1. Click on the field inside the form editor
  2. Toggle:
    • Make this field hidden
  3. (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_q2 is stored on submission 

Step 5: Validate Submission

  1. Submit the form using a test URL
  2. Navigate to:
    • Contacts → Open record
  3. Confirm:
    • Property value is populated correctly

Advanced Configuration


Option A: Use Standard UTM Parameters

HubSpot automatically captures:

  • utm_source
  • utm_medium
  • utm_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>
 

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.

Becky Brown bio