Can I auto-populate form fields through a query string?

Last updated: April 13, 2017

Available For:

Marketing: Basic, Pro, Enterprise
Sales: N/A

Yes, users can create custom personalized URLs for pages containing forms that auto-populate form field values through the use of a query string.

Use the Internal Name of the contact property

In order to accomplish this you must use the Internal name of the contact property, not the Label.
  • In your HubSpot Marketing account, navigate to Contacts > Contacts Settings.
  • Search for the desired property and click to edit.
  • Here you will see the Internal name of the property to use in your query string. You can then use that internatl name in the query string of your URL to auto-populate the field when the user follows the link to your landing page.
    • Example URL:

use-internal-name-in-query-string.pngThis works for the following field types: single-line text, multi-line text, dropdown select, multiple checkboxes, number, radio select, single checkbox, and date picker. This also works for form fields that are hidden on your form. Please note it is not possible to use query strings to auto-populate dependent form fields

Proper formatting of values

Proper formatting of values in the query string must match the exact settings of the properties used. Here are some rules:

  • Single checkbox must contain either a true or false value, not yes or no.
  • Date picker must contain a date value in a MM/DD/YYYY format.
  • Multiple checkboxes values must match the property's value options exactly, with a semi-colon separating multiple values.
  • Radio select and Dropdown select values must match the property's value options exactly.

A properly formatted query string:

Here is an example of a properly formatted query string using many property types:;Hurricane&number_property=7&will_you_come_to_the_party=Maybe&do_you_like_parties=true&date_of_party=01/07/2016

  • The start of the query string must first contain a question mark (?).
  • After the question mark, type the Internal Names of each of the fields you wish to auto-populate with an equal sign (=) separating the Internal name and its value.
  • Separate each new property with an ampersand (&)

Here is a breakdown of the above example:

  • Beginning of query string and single-line text:   ?firstname=John
  • Single line text:    &
  • Dropdown select:    &favorite_season=Winter
  • Multiple checkboxes:    &favorite_natural_disasters=Blizzard;Hurricane
  • Number:    &favorite_number=7
  • Radio select:    &will_you_come_to_the_party=Maybe
  • Single checkbox:    &do_you_like_parties=true
  • Date Picker:     &date_of_party=01/07/2016

Using Personalization Tokens with query strings

You can also accomplish this custom personalized URL functionality en masse by using personalization tokens in the query string of the link.

Please note: This will only function as intended if the link is going to HubSpot-hosted content with a HubSpot form and the link is placed on a HubSpot hosted page (or HubSpot email) or an externally hosted page with the HubSpot tracking code.

Here's how this would work in a HubSpot email, as an example:

  • In your email, find the link that you'd like to personalize. In this example, we'll use


  • Click the personalization icon in the toolbar, and select the property that you'd like to use to send a personalized URL. We'll choose First Name here.
  • Once added, click Tools > Source code in the menu to get the code for the personalization token to use in your query string. In this case, we want to use first name so the token code is {{contact.firstname}}
Add Personalization and Grab Code of Token
  • Highlight the URL and click the link icon in the toolbar. 
  • Add a query string to the end of the link as follows:, then click Update link.

If you wish to test this, you may send yourself a test email as a particular contact, using the instructions here.

Was this article helpful?