Newer post available

Hi there, you are viewing an old post that is a bit outdated. Click here to view the post with the latest instructions.

You might already be using UTM parameters to track your marketing campaigns with Google Analytics, but are you capturing that information when a prospect is created in Pardot? Capturing this data is critical in order to assess the value of your marketing campaign and is a lead management best practice.

What are UTM Parameters?

UTM parameters are tags you add to a URL. Marketers use this to be able to track the traffic from a variety of sources such as email, social media, banner ads, etc. The tags can be sent back to Google Analytics and tracked which can be used to gauge the effectiveness of campaigns and identify the best ways to drive more visitors to your website.

hidden-fields-in-forms-3

Create New Fields

The first thing you need to do is create 2 new fields in Salesforce and in Pardot and map them. You don’t need to create a field for utm_source, we will use the standard source field in Pardot.

  1. utm_medium
  2. utm_campaign

hidden-fields-in-forms-2

Add The New Fields to Your Pardot Forms

Next, add the fields to your Pardot form. All 3 fields should be hidden and not marked as required.

Add Some Code to Your Landing Page Templates

This piece of code will parse the URL parameters and put the values into the hidden fields within your form. This code can be placed within your landing page template or within your form in the below form section.


Note: If you don’t use the field names outlined in this tutorial, you might need to update the JavaScript to include the correct field names.

Create URLs and Test

Now you’re ready to start creating URLs and testing your form. Use this handy URL builder to create your links and then fill out the form to see if the values go into Pardot.

Questions?

Send them to me via email, send me a tweet @jennamolby, or leave a comment

Author

I'm a Freelance Marketing Operations Consultant With 15 years of experience in Marketing Operations, I’ve worked with a wide range of tools including Salesforce, Marketing Cloud Account Engagement (Pardot), Marketo, and many other sales and marketing platforms. I help teams optimize their tech stacks, improve processes, and get accurate, actionable reporting. Whether it’s setting up your Marketing Automation Platform, building Salesforce reports, managing lead lifecycles, tracking attribution, or integrating your tech stack, I ensure everything is aligned to drive real results.

57 Comments

  1. Hi Jenna.

    Thank you so very much for this article! I was able to implement using form handlers, although it was a little different than your instructions.

    I do have a question though: Can you use this to collect data from ValueTrack parameters in addition to UTM parameters?
    I’ve adjusted the code to collect that data, added the hidden fields, added the fields in Pardot, mapped them, etc. However, the ValueTrack data just isn’t pulling in. I can see the parameters in the URL when I look at my test prospect in Pardot, but the UTM parameters is all that is being captured. Could you offer any advice?

    • Jenna Molby

      Hi Lissa, You’re welcome! Yes, you can use this to collect data from ValueTrack, as long as the parameter is in the URL. You might have an incorrect field or parameter name in the code. You can email me at [email protected] with a link to your page and I can take a look. Cheers, Jenna

  2. Manoj Pradhyumna Reply

    I am using the above code in the form and works perfectly if i access the form link. But if I fill the same from on a landing page, the parameters are not being captured.

    • Jenna Molby

      Hi Manoj, Where are you placing the code? In your form or your layout template? Cheers, Jenna

  3. Hi Jenna, great article!! I’ve created the custom UTM fields with Pardot as the master and implemented the code on my layout template. The values populate beautifully on new and existing prospects if the fields are empty. However, if there are values in the fields and the prospect submits additional landing pages, the UTM values are not being overwritten. I thought that the code would allow that to happen. Did I misunderstand?

    • Jenna Molby

      Hi Pam, Thank you! This code is set up to overwrite the values. I would recommend double-checking your form settings to ensure the UTM fields aren’t set up to pre-populate. Cheers, Jenna

    • Hi Jenna, by form settings, do you mean the “Do not prefill” on the Advanced tab of the form? If so, I’ve checked that box and tested, and the values are still not being overwritten. I’m stumped. Thanks for your help!!

  4. Ren Walker Reply

    Will the Javascript be able to pass the URL parameters instead of using Pardot’s landing pages, we’re instead embedding an iframe with the form in it. For example, we use InstaPage to design our landing pages and place the form in our pages using the script generated by Pardot. But…that brings up an issue of if the browser will accurately pass in the UTM parameters.

    Can we use the Javascript you’ve suggested and 1) place it in the Pardot form’s Layout Template, 2) place it in the scripts on the InstaPage builder (we can add items to the header/footer), or 3) need another version of the code to capture the browser URL and pass into the iframe with the Pardot form and its handy hidden fields (and then…does that go in the Pardot Layout Template or on the InstaPage page).

  5. Lucy Mazalon Reply

    Hi Jenna,

    Thank you so much for this – it’s enabling so many people to move from first touch to multi-touch attribution!
    I have a question. I used the code on a Pardot form on a Pardot landing page, and it works well… only when it’s the prospects first touch only! If the prospect exists already, it is not overriding the custom prospect fields I have set up. Surely it should update each time the form is submitted? It’s not due to field sync behaviour, as these fields are set to Pardot as the master.

    Is there any changes to the code i need to make here?

    Any help much appreciated! 🙂
    Thanks,
    Lucy

    • Jenna Molby

      Hi Lucy, You’re welcome! So happy you find it helpful :). This code is set up to populate the fields every time. I wonder if your form fields are set up to pre-fill? Cheers, Jenna

Write A Comment