2021-09-06T04:39:06+01:00
Training
2021-09-06T04:39:06+01:00

How to Pass UTM Variables to a Pardot iframe

August 11, 2021

How to Pass UTM Variables to a Pardot iframe

MarCloud Apple iPad retina favicon

 Pardot iframe •  Form tracking

UTM variables are incredibly useful for marketing attribution. They tell us which of our prospects came from particular marketing activities, such as LinkedIn ads, for example. When it comes to tracking UTM variables and passing these into Pardot, forms embedded in a Pardot iframe can cause some issues, as there is a lack of connection between the external page that the form sits on (i.e. on a WordPress web page) and the Pardot form within the iframe.

However, this is nothing that a bit of custom Javascript can’t fix! Whilst you can enable the native Google Analytics connector within Pardot, this will only populate UTMs on a first-touch basis, and you are restricted to the five default variables. Our solution allows you to collect custom variables, and you can collect them over multiple form submissions. Keep on reading to learn how to pass UTM variables to a Pardot iframe (without using the Google Analytics connector) in three easy steps.

Note: Custom Javascript is sensitive to cases, punctuation, and formatting. We strongly advise against using this tutorial unless you are comfortable with editing code yourself.

Step 1: Custom fields

Before we can track any field values, we first need to create the custom fields. For standard UTM tracking, you will want to create the following fields, exactly as shown: 

  • utm_source
  • utm_medium
  • utm_campaign
  • utm_content
  • utm_term

Once these are created, you can add them to your forms. These will each need to be added as a hidden field with the text type that is not required

If you would like to track any other field values, create these in the same format; spaces should be formatted as underscores, and all lowercase letters.

Step 2: Below-form code

Place the following Javascript in the below-form section of your Pardot form:

Copy to Clipboard

To track your own custom field values, you can add additional fields to the Javascript, such as:

Copy to Clipboard

For example, the custom Javascript for a field with the ID of example_field would be as follows:

Copy to Clipboard

Step 3: Landing page code

Lastly, we must amend our website code to allow the custom Javascript to fire. For this to work, we must also amend the Pardot iframe code on the landing page to include an ID (you can choose whichever ID you like), and then paste the following code right beneath the iframe on the landing page: 

Copy to Clipboard

An example of how this code would look in its entirety on a landing page is shown below:

Copy to Clipboard

If you have more than one iframe form on a page, it is crucial that you give each iframe a new ID. An example of the full landing page code for an iframe with the ID of ‘newsletter_form’ is shown below:

Copy to Clipboard

And that’s it! You have just successfully set up custom UTM tracking on a Pardot iframe. 

For information about tracking conversions from Pardot forms in iframes within Google Analytics too (another common issue for Pardot users), you can visit our full guide to Pardot form tracking using Google Tag Manager.

If this all sounds a bit too technical for you and you’d prefer to have an expert assist you, feel free to send us a message. We can liaise with your web developer to ensure all of your Pardot form tracking is set up correctly.  

Need a hand getting the most out of your Pardot or Salesforce account?

MarCloud is a team of certified Pardot and Salesforce specialists. We help businesses to unlock the potential of marketing automation.

Ready to save time, deliver more quality leads, and generate more revenue? Here's how we help.

VIEW SERVICES

Hollie Fitzpatrick

With a keen interest in marketing technologies, Hollie strives to find the best solution to increase the efficiency and quality of marketing campaigns through rigorous testing and data analysis. In her free time, Hollie enjoys portrait art and learning new skills.

More by Hollie Fitzpatrick →