This article outlines creating a script for adding dynamic inputs to hidden Pardot fields.
It will allow you to capture any utm_source, utm_campaign & utm_medium fields on the URL, and it captures the current page when the Pardot form is being framed in another site (WordPress, Drupal, etc..)
Pardot Forms are hosted on Pardot. This allows Pardot to use its intelligence features, like progressive profiling. When we use Pardot forms, we are actually framing a Pardot page on our site.
While this helps our forms interface with Pardot better, there are limitations. Particularly when we want to capture URL data from the browser and share it with Pardot. This is called, ‘cross-domain blocking’ (you can learn more about this here)
This limitation occurs even if you’re using a Pardot tracking domain and the TLD is a match.
The steps outlined below will allow you to bypass the cross-domain blocking and capture all the ‘good stuff’ into Pardot. I hope you enjoy!
1. ON YOUR WEBSITE (WordPress…etc)
*NOTE: your iframe src=”” will be your Pardot form URL. We need the ?url=’ + url + ‘” to share the page URL with Pardot. By calling the Iframe this way, the web browser will allow pardot to ‘read’ the URL information
2. IN PARDOT
we create the following additional fields: last_submitted_page_URL, utm_source, utm_medium, utm_campaign. It is important that the API name, label and form label all match for this script to work easily across multiple forms, as needed.
Alternatively, you can publish your form and grab the Pardot field ID. While this method can be much cleaner, it’s requires additional steps to find the field ID for each form. If you intend on using the field IDs for your own variation of this script, the name or label will not matter.
3. PARDOT FORM BUILDER STEP 2 FIELDS
In our Pardot form, we’ll add the fields we created as ‘hidden’ fields. The field label should match the field ID.
4. PARDOT FORM BUILDER STEP 3 LOOK AND FIELD
In the ‘Below Form’ editor, switch to HTML view (furthest top-right icon in the WYSIWYG editor. Looks like a piece of paper with <> inside. Add the following script:
Note: This uses an original script from jennamolby.com. We’ve added some additional steps to communicate with the Parent Page through the iframe.
Once these steps are done, you’ll be able to capture the url, utm_source, utm_medium & utm_campaign of the page used for submitting the form, regardless of whether or not the domain matches.