Optimize: Auto‑Fill Lead Forms with URL Parameters

Overview

Automatically capture the data that matters most. With Walnut share links, you can pass email parameters, UTM parameters, and custom parameters  straight into your HubSpot, Pardot, or Marketo forms — ensuring every viewer and campaign touchpoint is tracked without lifting a finger.


Optimize: Combine Parameters with a Lead Form 🎯

Because email parameters act as a primary form of identification, it is not necessary to use an email gate or lead form to capture viewer emails.

However, adding a lead form alongside parameters can provide valuable additional context — such as job title, company size, or interest area — and help you better understand viewer intent. Combining parameters (email, UTM, and custom) with a lead form gives you the best of both worlds:

    • Parameters automatically capture essential viewer information and campaign context.

    • Lead forms add richer details for a more complete profile.

    • Together, they make it easier to qualify leads, understand intent, and personalize follow‑up outreach.

🫆 New to parameters? Start with this primer: Track and Identify Viewers with URL Parameters (Email, UTM, and Custom)


When to Use This Setup

Use this setup when you want to automatically capture viewer and campaign data without asking your audience to manually fill in those details. It’s especially useful when:

  • You’re sharing Walnut demos, templates, or playlists using share links and want to pass email, UTM, or custom parameters directly into your lead forms.
  • Your lead form is hosted in HubSpot, Pardot, or Marketo and you want those fields to auto-fill based on URL parameters.
  • You want to combine automatic parameter capture with a lead form to collect richer details (e.g., job title, company size, interest area) for better lead qualification.
  • You need to ensure every viewer and campaign touchpoint is tracked and attributed without adding extra friction for your audience.

This approach reduces manual input, eliminates errors, and ensures your marketing automation platform receives accurate, complete data for each lead.


Quick Start Guide

  1. Choose your platform: HubSpot, Pardot, or Marketo.
  2. Prepare your Walnut link by appending parameters like ?email=<merge_tag>&utm_campaign=....
  3. Configure your form fields:
    • In HubSpot: use the script below to enable auto‑fill.
    • In Pardot & Marketo: set hidden fields to pull from URL parameters.
  4. Test your link: Open the Walnut link and confirm fields are auto‑filled.

Auto-Fill HubSpot Lead Forms

When a HubSpot form loads, the script checks the referring page URL for query parameters. It then extracts values (e.g., ?email=shellvis.ca@crunchy.ai or &utm_campaign=linkedin) and fills matching HubSpot form fields based on the field’s name attribute.

HubSpot Configuration Steps:

  1. In HubSpot, create or edit the form you want to auto‑fill.
  2. For each field you want to populate (e.g., Email, Campaign, Persona):
    • Inspect the form in your browser (right‑click → Inspect).
    • Find the field’s name attribute (e.g., <input type="text" name="persona">).
  3. Build your Walnut share link using matching keys:
    • https://wlnt.io/s/zhJOUC?email={{contact.email}}&utm_campaign={{campaign.name}}&persona={{contact.persona}}
  4. Open your Walnut template, go to the Forms panel, and paste your HubSpot form script in the Embed code section.
  5. Then, paste the following script directly below the HubSpot form script:
<script>
(function () {
  window.addEventListener('message', event = {
    if (event.data.type === 'hsFormCallback' 
        && event.data.eventName === 'onFormReady') {
      const [_, search] = parent.parent.document.referrer.split('?');
      if (!search) return;

      const searchParams = new URLSearchParams(search);
      searchParams.forEach((value, key) = {
        const input = document.querySelector(`input[name=${key}]`);
        if (input) input.value = value;
      });
    }
  });
})();
</script>

🗒️ Note: The script automatically works for any number of parameters — as long as the parameter keys in your Walnut link match the name attributes of the HubSpot form fields.


HubSpot Mapping Example

HubSpot requires a script. Parameter keys must match the form field name attributes.

Example link:

https://wlnt.io/s/zhJOUC?email=shellvis.ca@crunchy.ai&utm_campaign=linkedin&persona=marketing-lead

Walnut Link Parameter Key Example Value HubSpot Field Populated
email=shellvis.ca@crunchy.ai email shellvis.ca@crunchy.ai Email
utm_campaign=linkedin utm_campaign linkedin UTM Campaign
persona=marketing-lead persona marketing-lead Persona

How HubSpot Key/Value Pairs Work:

  • Each parameter in the Walnut link is a key/value pair.

    • email=shellvis.ca@crunchy.aiKey: email, Value: shellvis.ca@crunchy.ai

    • utm_campaign=linkedinKey: utm_campaign, Value: linkedin

    • persona=marketing-leadKey: persona, Value: marketing-lead

  • The key must match the name attribute of the HubSpot form field you want to populate.

    • Example: if your HubSpot email field has name="email", then ?email=shellvis.ca@crunchy.ai will auto‑fill that field.

    • If the names don’t match, the field won’t populate.


Auto-Fill Pardot Lead Forms

👉 Important to Note: Pardot does not require any extra scripts for field mapping. The only requirement is that your Walnut link parameters exactly match your form field names configured to pull values from URL parameters.

The key/value mapping is 1:1:

  • Key in Walnut link → must match the Pardot form field name

  • Value in Walnut link → becomes the data recorded in the form field

Pardot Configuration Steps:

  1. Create your Pardot form.
    • Go to Marketing > Forms in Pardot and create a new form (or edit an existing one).
  2. Add form fields for the parameters you want to capture.
    • Example fields:
      • Email → name: email
      • UTM Campaign → name: utm_campaign
      • UTM Source → name: utm_source
  3. Set the fields to Hidden.
    • In the field settings, choose Hidden so visitors won’t see these fields, but values will still be recorded.
  4. Build your Walnut share link with matching parameters.
  5. Test your setup.
    • Open the Walnut link, submit the form, and confirm that the Pardot lead record includes the captured values.

Pardot Mapping Example

Pardot does not require an extra script. Keys in the Walnut link must match hidden Pardot field names.

Example link:

https://wlnt.io/s/zhJOUC?email=shellvis.ca@crunchy.ai&utm_campaign=linkedin&utm_source=demo

Walnut Link Parameter Key Example Value Pardot Field Populated
email=shellvis.ca@crunchy.ai email shellvis.ca@crunchy.ai Email
utm_campaign=linkedin utm_campaign linkedin UTM Campaign
utm_source=demo utm_source demo UTM Source

Auto-Fill Marketo Lead Forms

👉 Important to Note: Marketo does not require any extra scripts for field mapping. The only requirement is that your Walnut link parameters exactly match your form field names configured to pull values from URL parameters.

The key/value mapping is 1:1:

  • Key in Walnut link → must match the Marketo form field name
  • Value in Walnut link → becomes the data recorded in the form field

In Marketo, you can use URL parameters to auto‑populate hidden form fields. Marketo’s form script supports mapping query string values into fields when configured correctly.

Marketo Configuration Steps:

  1. In Marketo, edit your form and add hidden fields for email, persona, or other custom values.
  2. Under the form field settings, configure Get Value from → URL Parameter.
  3. Ensure the Walnut link includes those parameters so they are passed into the form on submission.

Marketo Mapping Example

Marketo does not require an extra script. Configure each hidden field to Get Value from → URL Parameter.

Example link:

https://wlnt.io/s/zhJOUC?email={{lead.Email Address:default=noemail}}&persona=marketing-lead&utm_campaign=linkedin

Walnut Link Parameter Key Example Value Marketo Field Populated
email={{lead.Email Address:default=noemail}} email shellvis.ca@crunchy.ai Email
persona=marketing-lead persona marketing-lead Persona
utm_campaign=linkedin utm_campaign linkedin UTM Campaign

Was this article helpful?
0 out of 0 found this helpful