Pardot Knowledge Base

Populate Hidden Field on Form with Name of Webpage

Last Updated: Oct 05, 2016 | Print this Article
Whoa there, partner! This is an advanced topic that involves custom script. Troubleshooting custom script is outside of Pardot Support’s scope, so proceed with caution.

You may have a single Pardot form on multiple pages of your site (like a newsletter signup form) and want easy access to know what page that form was completed on. To populate a hidden field on a form with the name of the page where the prospect completed the form you can use the following steps:

  1. Create a new custom field with the type of 'Hidden' to contain the page name value in the prospect record. (Note the Field ID for future steps)
  2. Copy and paste this HTML code in your webpage where you would like the form to appear:
  3. Update the Custom_Field_ID portion of var fieldId = "Custom_Field_ID"; to be the Field ID of the new custom hidden field you just created.
  4. Update the Form URL portion of var formUrl = ""; to be the link to the Pardot form.
  5. Edit your form and add your hidden field using the Form Wizard’s drag and drop form builder. For more on hidden form fields please see this article.
  6. Save these updates and test to confirm the page name where the form was completed is recorded in Pardot.
  • Within the document.write('<iframe... portion of the script you can update the height and width of the iframe to best fit within the allotted page area.
  • When applying these steps to a Form Handler instead of a Pardot Form, update the Form URL with the post URL from the form handler code instead of the link to the Pardot form. To find this URL from your Pardot Dashboard, Marketing > Forms > Form Handlers > select the form handler > View Form Handler Code > copy URL after 'form action=' and before 'method='
  • The page title recorded in the custom field you create in step 1.
  • The custom field be mapped to the CRM. Create the custom field in your CRM. Then navigate (in Pardot) to Admin > Configure Fields > Prospect Fields > Edit Custom field and select which CRM field you wish to map the data to.
  • Pardot pulls the page name from between the <title> </title> tags in the HTML of the webpage.

Need more? Start a conversation with other Pardot users in the Trailblazer Community