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:
- 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)
- Copy and paste this HTML code in your webpage where you would like the form to appear:
- 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.
- Update the Form URL http://cname.company.com/12345/ABCDE portion of var formUrl = “http://cname.company.com/12345/ABCDE”; to be the link to the Pardot form.
- 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=’